SD Card file in simulation
Posted: Tue Jul 19, 2022 11:53 pm
This had me scratching my head for a while
FileSD::CreateFile(filename)
FileSD::OpenFile(filename)
FileSD::AppendString("Some data")
FileSD::ReadByteFromIndex [0..n] "Some data" back (doesn't work if run.)
This worked correctly if single stepping the code. However, if the code was 'run' then it didn't work.
Note that the 'logic' of the program was to open a file and read some initial config data from it. If the file didn't exist then it would be created - initial data written - and then continue with the read.
Adding a 1s delay after CreateFile solved the problem ? (Note the file was created on a ram disk)
Martin
FileSD::CreateFile(filename)
FileSD::OpenFile(filename)
FileSD::AppendString("Some data")
FileSD::ReadByteFromIndex [0..n] "Some data" back (doesn't work if run.)
This worked correctly if single stepping the code. However, if the code was 'run' then it didn't work.
Note that the 'logic' of the program was to open a file and read some initial config data from it. If the file didn't exist then it would be created - initial data written - and then continue with the read.
Adding a 1s delay after CreateFile solved the problem ? (Note the file was created on a ram disk)
Martin