完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我很难理解如何使用FILIO搜索函数返回的值打开一个文件。下面是我正在做的一个剪辑。我知道这是“conchar *”,这是我的命,我就是不知道如何正确地插入文件名。我已经成功地使用了一个文件名/路径的文本输入。我可以快速查看和评论吗?成功使用-如果(FieloOxOpOpen[Adv.MyField],Txt,FieloOxOpenSyRead)= FieloOxReultTug成功似乎不能得到它的正确性,(//////////If(FieloOyRead(“**.bdg”,FieloOy AtditTyApple Stand,and SalkRebug,TRUE)= = FieloOxReultTug成功)为(BuffelyTrimeType=0;BuffelyTrime<Excel文件名)FieldRelo+++)文件[1 ] .SuffyFieldNo.[BuffelyTrime] = SchurchReal.SimFrimeNoM[BuffelyTrime];IF(FieloOxOnLead(Apple;MyFielfile,文件[1 ] .SimultFieleNeXEnter,FieloOx OpenSyRead)= = FieloOxReultTuxValm)////////Ont:In FieloOxOPEN(FieloObObjultFielpTR,const char *)路径名,Uti1616T模式)谢谢。
以上来自于百度翻译 以下为原文 I'm having trouble understanding how to open a file using the returned value from the FILEIO search function. Below is a snip of what I'm doing. I know it's the " const char * " that's killing me, I just can't figure out how to properly insert the file name. I've used the feature successfully with a straight forward text entry for the file name/path. You experts know this stuff well. Can I get a quick look and comment? Successful use - if (FILEIO_Open(&myFile, "INDEX.TXT", FILEIO_OPEN_READ) == FILEIO_RESULT_SUCCESS) Can't seem to get it right - /////////// if (FILEIO_Find("*.BDG", FILEIO_ATTRIBUTE_MASK, &SearchResult, true) == FILEIO_RESULT_SUCCESS) for (buffer_transfer=0; buffer_transfer if (FILEIO_Open(&myFile, file[1].short_file_name, FILEIO_OPEN_READ) == FILEIO_RESULT_SUCCESS) ///////// Documentation: int FILEIO_Open ( FILEIO_OBJECT * filePtr, const char * pathName, uint16_t mode) Thanks. |
|
相关推荐
10个回答
|
|
|
在猜测中,复制文件名的代码不包括终止空值。
以上来自于百度翻译 以下为原文 At a guess, your code copying the filename is not including the terminating NULL. |
|
|
|
|
|
不,它在那里…我可以使用函数找到的每一个引用显式声明“*.txt”文件名。我找不到使用搜索结果的例子。
以上来自于百度翻译 以下为原文 Nope, it's there.... every reference I can find using the function explicitly states "*.TXT" the file name. I find no examples with a search result being used. |
|
|
|
|
|
文件[1 ]是如何定义的?替换所有这些:
以上来自于百度翻译 以下为原文 How is file[1] defined? Replace all of this: for (buffer_transfer=0; buffer_transfer |
|
|
|
|
|
OOOOPS,我刚刚发现我发布了一个程序,它也可以工作。这就是我如何将缓冲区从搜索结果填充到缓冲区。如果是SyTeX,我认为它可能会有帮助。//我尝试在生成相同错误的系统提供的结果缓冲区中定义uu88t。我还尝试将搜索结果缓冲区更改为字符,以避免任何类型的CAST问题。结果缓冲区填充(内置警告)在Syth.TyPulfStrut{chAR/*或uTn8*t*/StaseFieleNoNe[短文件FielnMaEnEithLime]中…配置文件;外部配置调用(Max);如果(FieloOxOnEngt(&;MyField,调用[0).StaskFieleNeNeX,FieloOx OpenSRead)!=文件UIT1616T与搜索返回UIT88T/CHAR有冲突。这看起来像是芯片上的一个问题?//.pdf int FieloOxOPEN(FieloObObjultFielpTR,const UINT1616T*PATNEXT,UIN1616T模式);//C实现…int FieloOxOPEN(FieloObObjultFielpTR,const char *文件名,UIN1616T模式)// C函数使用…如果(FieloOxOnLead(和;MyField,SqrReult.StimFrimeNeNe,FieloOxOpenSyRead)!/在所有情况下,它返回错误-IF(FieloOyErrRoGET(“a”)=FieloOyErrrOrthRO).FieloOyErrrOrthOndo-无法找到目录条目。//使用搜索结果的目录错误?将搜索返回的字节宽转换为UTI1616T是有意义的吗?使用.txt打开文件。
以上来自于百度翻译 以下为原文 Oooops, i just caught I posted the routine that also works. Works - This is showing how I filled the buffer for reference full path from search.results to my buffer. If it's syntex, I thought it might help. // I tried char in place of uint8_t as defined in the result buffer provided by the system generating the same error. I also tried changing the search result buffer to char to avoid any type cast issues. The result buffer filled (built with warnings) correctly in both scenarios. typedef struct{ char /*or uint8_t*/ short_file_name[SHORT_FILE_NAME_LENGTH]; .... } PROFILE; extern PROFILE call[MAX_NUM]; if (FILEIO_Open(&myFile, call[0].short_file_name, FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // Is it possible the documented uint16_t conflicts with with the searches returned uint8_t/char. This looks like an issue on the Microchip side? int FILEIO_Open(FILEIO_OBJECT * filePtr, const uint16_t * pathName, uint16_t mode); //.c - implementation.... int FILEIO_Open (FILEIO_OBJECT * filePtr, const char * fileName, uint16_t mode) //.c - function use.... if (FILEIO_Open(&myFile, SearchResult.shortFileName, FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // In all cases it returns the error - if(FILEIO_ErrorGet('A') == FILEIO_ERROR_DONE) • FILEIO_ERROR_DONE - The directory entry could not be found. // Directory error using SearchResult? Would converting the search returned BYTE wide into a uint16_t make sense? Using .TXT works for opening a file. |
|
|
|
|
|
什么是短文件名?不,你正在查看PDF中的长文件名版本,它使用UTI1616T**用于文件名。
以上来自于百度翻译 以下为原文 What is SHORT_FILE_NAME_LENGTH? No. You're looking at the long file name version in the PDF, which uses uint16_t* for file names. |
|
|
|
|
|
Excel文件长度为13。我可以在我的变量窗口中看到null终止。实际上我把它扩展到了14。
以上来自于百度翻译 以下为原文 SHORT_FILE_NAME_LENGTH is 13. I can see the null termination in my variables window. I actually extended it to 14 as a shot in the dark. |
|
|
|
|
|
好的,我已经使用了GETError例程,发现下面是问题。我希望有人可以对此进行评论,我有正确的格式,但它不会打开/读取特定的文件类型。我更改了文本和数据文件的扩展名。无论扩展名如何,文本文件都正确打开。数据文件不会打开和读取任何8.3扩展。一旦执行了打开命令,FieloOx Read()就跟随来填充缓冲区。这是打开的命令,看起来很困难。//填充缓冲区/IF(FieloOxopen(ANP;MyField),index .txt”,FieloOx OpenSRead)!= FILIOORRESUTTION成功)//直截了当的文本文件IF(FILIOOXOPEN(ANP;MYFILE),索引BDG”,FieloOx OpenSRead)!= FILIOORRESUTTION成功)//更改文本文件扩展以确保BDG是(OK)(文本文件)如果(FieloOxOPEN(和;MyFrfile,SeaReult.StimFrimeNeNe,FieloOxOpenSyRead)!= FieloOxReultToWin)//打开索引。BDG(具有.bdg扩展名的文本文件)从搜索函数(FILIOOXOPEN(ANP;MyFrfile),index .doc”,FieloOx OpenSRead)!= FILIOORRESUTTION成功)//将文本文件更改为DOCif(FILIOOXOPEN(ANP;MyFrfile),index BLF”,FieloOx OpenSRead)!= FILIOORRESUTTION成功)//将文本文件更改为另一个奇数扩展/ /不填充缓冲器//IF(FILIOOXOPEN(ANP;MyFrfile),9Real.BDG”,FieloOx OpenSRead)!= FILIOORRESUTTION成功)//IF(FILIOOXOPEN(ANP;MyFrEX,SeaReult.StimFrimeNeNe,FieloOxOpenSyRead)!=只有数据(非文本)文件可用(如果FieloOxOn(Apple;MyField),9Real.doc”,FieloOx OpenSRead)!= FILIOOL RESULTTA成功)/ /改变了数据文件的扩展?感谢阿达文斯
以上来自于百度翻译 以下为原文 OK, I've used the geterror routine and found the following is the issue. I hope someone can comment on this one, I have the format correct but, it won't open/read specific file types. I changed the extensions on both text and data files. The text files open correctly no matter the extension. The data file won't open and read with any 8.3 extension. Once the open command is executed a FILEIO_Read() follows to fill the buffer. It's the open command that appears to be struggling. // fills Buffer// if (FILEIO_Open(&myFile, "INDEX.TXT" , FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // - Straight forward text file if (FILEIO_Open(&myFile, "INDEX.BDG" , FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // - changed the text file extension to ensure .bdg was OK (text file) if (FILEIO_Open(&myFile, SearchResult.shortFileName, FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // - opened INDEX.BDG (text file with .bdg extension) from search function if (FILEIO_Open(&myFile, "INDEX.DOC", FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // - changed the text file to .DOC if (FILEIO_Open(&myFile, "INDEX.BLF", FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // - changed the text file to another odd extension // does not fill buffer// if (FILEIO_Open(&myFile, "9RED.BDG", FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // - if (FILEIO_Open(&myFile, SearchResult.shortFileName, FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // - when only data (non text) files available if (FILEIO_Open(&myFile, "9RED.DOC", FILEIO_OPEN_READ) != FILEIO_RESULT_SUCCESS) // - changed extension of data file Thoughts? Thanks in adavance |
|
|
|
|
|
FILIO没有“文本文件”或“数据文件”;它只有文件。它没有任何特殊的文件扩展处理。无论你的问题是什么与文件的名称或它们的内容无关。
以上来自于百度翻译 以下为原文 FILEIO doesn't have "text files" or "data files"; it just has files. And it doesn't have any special handling of any file extensions. Whatever your issue is has nothing to do with the names of the files or their contents. |
|
|
|
|
|
|
|
|
|
|
|
我完全同意文件类型对操作没有任何影响。我四处寻找我能做的一切来弄明白为什么它不会打开/阅读。这就是更改扩展的原因。有趣的问题。我修剪了这个项目,并用USB文件把它拉开,打开了一张票。我们将看看它是如何发挥出来的。QYB,代码本身是如此简单(一旦我修剪了所有其他东西)我不知道它可以在任何其他地方。FieloOxOPEN()和FieloOx Read()操作是相同的(文件句柄、缓冲区、传输大小),只有不同的目标文件…嗯,当AE团队检查我的项目文件时,我会发布答案。
以上来自于百度翻译 以下为原文 jtemples, I completely agree that the file type should have no impact on the operation. I was poking around trying everything I could to figure out why it wouldn't open/read. That's the reason for changing the extensions. Interesting issue. I trimmed the project and zipped it up (with USB files) and opened a ticket. We'll see how it plays out. qyb, The code itself is so simple (once I trimmed everything else out) I don't know how it could be anywhere else. The FILEIO_Open() and FILEIO_Read() operations are identical (file handle, buffer, transfer size) with only differing target files..... Hmm, I'll post the answer when the AE team examines my project files. T |
|
|
|
|
只有小组成员才能发言,加入小组>>
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
514 浏览 0 评论
5819 浏览 9 评论
2351 浏览 8 评论
2238 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3545 浏览 3 评论
1169浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
1123浏览 1评论
我是Microchip 的代理商,有PIC16F1829T-I/SS 技术问题可以咨询我,微信:A-chip-Ti
893浏览 1评论
MPLAB X IDE V6.25版本怎么对bootloader和应用程序进行烧录
514浏览 0评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-17 12:01 , Processed in 1.113891 second(s), Total 90, Slave 73 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1368