Code: Select all
WriteFile( (PBYTE)"Hello World", "hworld.bin", strlen("Hello World") );
Code: Select all
rvW = fs_write( pDataToWrite, 1, NumBytes, fp );
if ( rvW != NumBytes )
iprintf( "\r\n*** Error in fs_write(%s): %ld out of %ld bytes writte\r\n", pFileName, rvW, NumBytes );
rvC = fs_close( fp ); // Close a previously opened file of type FS_FILE
if ( rvC != FS_NO_ERROR )
{
iprintf( "*** Error in fs_close(%s): ", pFileName );
DisplayEffsErrorCode( rvC );
return 0;
}
Here is the output:
File system version: EFFS_STD ver:1.91
Init NOR.
*** Error in fs_close(hworld.bin): F_ERR_INVALIDDRIVE
Found File [/hworld.bin] : 0 Bytes
Display time in gettimedate(): 00:00:00 |01/00/1980 |
hworld.bin |00:00:00 |01/00/1980 | 0 Bytes
I noticed in the EFFS-STD-HTTP example that there was a function for doing a write and read test, ReadWriteTest(), so I tried it and did a directory dump after it was complete. Same file close error and an empty file.
Here is the output.
--------------------
Creating test file: TestFile.txt
Wrote 15 bytes: Hello World 0
Wrote 15 bytes: Hello World 1
Wrote 15 bytes: Hello World 2
Wrote 15 bytes: Hello World 3
Wrote 15 bytes: Hello World 4
Rewinding file
Read 75 bytes:
Hello World 0
Hello World 1
Hello World 2
Hello World 3
Hello World 4
Closing file TestFile.txt
*** Error in fs_close(): F_ERR_INVALIDDRIVE
Found File [/TestFile.txt] : 0 Bytes
Display time in gettimedate(): 00:00:00 |01/00/1980 |
TestFile.txt |00:00:00 |01/00/1980 | 0 Bytes