4D systems Picaso uLCD 32PTU touch display library
Diff: Picaso_4DGL-32PTU_File.cpp
- Revision:
- 23:dd2c28fa4dfd
- Parent:
- 22:cea582ea74c1
- Child:
- 24:19c77967674e
--- a/Picaso_4DGL-32PTU_File.cpp Tue Sep 27 08:48:08 2016 +0000 +++ b/Picaso_4DGL-32PTU_File.cpp Tue Sep 27 10:45:38 2016 +0000 @@ -183,10 +183,12 @@ // returns the stringlength and filename, further tests can be made using // “Find Next File” or “Find Next File and Report” commands to find all the files // that match the wildcard class. +// +// you have to give the function the output char array to put filename in //************************************************************************** -char *PICASO_4DGL :: file_FindFirstRet(char *name) { +short PICASO_4DGL :: file_FindFirstRet(char *filename, char *outStr) { - int size = 3 + strlen(name); + int size = 3 + strlen(filename); int i, k, j = 2; char *command; command = (char *)malloc(sizeof(char) * size); @@ -194,17 +196,17 @@ command[0] = (FILE_FIRST_RET >> (8*1)) & 0xff; command[1] = (FILE_FIRST_RET >> (8*0)) & 0xff; - for (k = 0; k < size-1; k++) command[j++] = name[k]; + for (k = 0; k < size-1; k++) command[j++] = filename[k]; command[j] = 0; writeCOMMAND(command, size); - char filename[FILENAME_LENGTH]; // create filename array + short len = getFilenameResponse(outStr); free(command); #ifdef DEBUGMODE - pc.printf("\n\r DEBUG: %s count = %s\n\r", filename, success ? " true" : "false"); + pc.printf("\n\r DEBUG: Searching for %s Found filename = %s\n\r", filename, outStr); #endif - return filename; + return len; }