Hi all,
I'm using the CMSIS ftp client to upload a file to a server.. All the process is ok, create the file in the memory card, write some data, connect to the server, start session and put the file... everything is ok.. but, the file on the server is always empty.
When I debug the program and place a breakpoint on the ftp_client_fread function where is the fread function that reads the file from the SD card requested by the ftp client, the fread function is returning a 0 value that is an error (no data readed)... for this reason the file on the server have size zero.
The function receives a correct file handler but can't read enything. If I place in the ftp_client_fread function a full code to open a file and read (to be sure that the handler is ok) fread returns zero:
__weak uint32_t ftp_client_fread (void *file, uint8_t *buf, uint32_t len) { // Read block of data from local file in FTP client. size_t ret; char data[40]; FILE *f = fopen ("M0:\\hola.txt", "r"); if (f != NULL){ ret = fread (data, 10, 1, (FILE *)f); fclose (f); } return (ret); }
But the file exists and is OK with data.. Also I tested the same with a ramdrive and the same result...
Thanks
Hi,
Ok course... first finit ("M0:") and then fmount ("M0:")
In fact if I open the file int the main function or other thread I can read or write the file without problems... The only problem is in the ftp_client_fread callback...