Hey, The parallel Nand flash memory is interfaced with lpc1788 and file system is also implemented using keil library.
i have labeled the drive "MyDrv" while formating and created a folder with the name "Proto". I create files with extensions '*.txt'. Now before creating, the code searches in the nand memory (ffind), if file with the same name exists, then the function returns back and does not create a file.
for eg: i create a file with name 'Asp.txt' in proto folder. and fill it with some data. after the file is created, when i search for the same file using 'ffind("Proto\Asp.txt", &info)', it returns '0x1' (which indicates no such file found) and hence the function does not return.
but when i search 'Proto\Asp*.txt' it returns '0x0'.
The question is do i have to perform searches with '*' character (wildcard *)? cant we search for exact name using ffind('Proto\Asp.txt', &info)??
While debugging, after reset, ffind("Proto\Asp*.txt", &info) worked only twice. Then it created a file with name "Asp*.txt" in Proto folder. and no my function updates data stored in the same file, i.e. it fails to search the file. Cant figure out what is wrong?
Have you considered the meaning of "\a"? It's an attention (bell) signal. Correct way to write is "\\a" if you want a backslash followed by an 'a' in your text string.
I agree with you. But when I read the file name from info.name struct field, i get the name as "Asp.txt". I read the flash contents with the example code and found the same contents.
But i will still give it a try to what you have said.
Have you considered the meaning of "\a"?
A very common mistake. And, at least for me, something that is easy to forget to remember in the heat of coding.
No Per. I tried with "Proto\\Asp.txt" and "Proto\\Beta.txt", but the function still returns '0x01' indicating file not found.
And "Proto\\Beta*.txt" also failed to yield the results.
I am currently doing trial and error method to check what works(which obviously is a bad procedure, cant find other way).
Any body from keil to answer the question (in case any keil executive is watching the forum)??
Another thing to consider is if they do support case-insensitive matches - I wouldn't play with mixed case names unless the manual says it's ok.
Do you clear or initialize the FINFO variable before searching the file?
info variable according to your example _the one you pass to ffind(filepath, info)_
That did the trick. Thanx.
And a important note: "Protocol\Asp.txt" - the '\A' is does not act as a special character when used in the filename or filepath.
"Protocol\Asp.txt" - the '\A' is does not act as a special character when used in the filename or filepath.
And how do you think the compiler knows that the string is being used in a filename or filepath?
coz i call this function to load the filename/filepath
char* GetProtoFilePath(char *pFpath) { uint8_t i=0, name[PROTO_NAME_SIZE]; uint8_t file[] = PROTOCOL_FOLDER; ClearBuf(name, PROTO_NAME_SIZE); if(*pFpath == NULL) return NULL; while((*(pFpath+i) != NULL) && (*(pFpath+i) != '.') && i < PROTO_NAME_SIZE) { name[i++] = *(pFpath+i); } *pFpath = 0; strcat(pFpath, file); strcat(pFpath, name); strcat(pFpath, ".txt"); return pFpath; }
I get the filename from the uart. The compiler never comes across any string enclosed in double inverted commas. The array is passed to the ffind function.
Looks like you're very confused with certain aspects and nomenclature. Maybe a period of quiet time with some C reference manuals would do you good.
Looks like you're very confused with certain aspects and nomenclature. a very broad statement. Kindly point out the aspects and clear the confusions. all ears to you. will change and implement wherever required.
coz i call this function to load the filename/filepath That proves nothing whatsoever. That function doesn't visibly deal with any string literals, but that doesn't help you one bit if its inputs are already contaminated.
This line in particular
uint8_t file[] = PROTOCOL_FOLDER;
can only work if PROTOCOL_FOLDER is a preprocessor macro that does contain either a string literal or slightly disguised one (character literals in a braced initializser).
So your earlier testimony that your code did not deal with any strings in "quotes" was, essentially, a lie. Good we've cleaned that up.
And now we're supposed to believe that you went to the length of stripping all parts of the final pathname that won't change from the data that have to be transferred over the serial control line, but not the '\\'. So you transfer "\\A" to open file "Proto\\A.txt". Really? I find that rather hard to believe.
was, essentially, a lie was no intending to lie. but found out later that the macro is "Proto\\".