[En-Nut-Discussion] Strange behavior with files using file attributes '+' or 'a'

Michael Bieri mibieri at ee.ethz.ch
Tue Feb 26 17:45:17 CET 2008


Hi

I use an SD Card and PHAT filesystem for some (binary) files. It's no 
problem to read or write files, but as soon as I use the file attributes 
'+' or 'a' (so, if I try to modify an existing file), I get a very 
strange behavior:

- Sometimes, the 'a' attribute doesn't append my data, it only appends 
some trash with the same length at the end.
- Sometimes, the 'a' attribute doesn't start "inserting"/appending data 
at the end of my file, but inserts it at the beginning. fseek(..., 
SEEK_END) does fix this problem.
- If I try to insert some data with 'rb+', it behaves like an ordinary 
'w' (existing data is lost, but new data is there).

The same routines work properly with linux as well as with windows.

I really wonder if you know any similiar issues and how I could find a 
solution for this...

Michael



More information about the En-Nut-Discussion mailing list