zoret wrote:hey thanks but my code is ok
in the file i've the 2 strings
the problem is that the file contains the string in binary format
=> i see the strings in a soft like ultra edit, but not in note pad
this is similar to the "b" flag in the standard fopen function
is there another flag tha 0777 to specify that i open a text file and not a binary file ?
thanks !
Text is still binary. The only differences is sometimes in formating for things like '\n' will give you a 1 byte version vs a 2 byte version (the 1 byte version makes it look like there are no line breaks in notepad but yet when viewed in another tool it shows up with line breaks).
Looking over the code again. The bug at hand is because you are telling it to write 10 bytes when you are only passing it 9 bytes of data. So the function will add 1 line of junk data (usaly a 0). the null terminator character is breaking things when viewed in notepad (not sure why notepad does this).
I had this same issue before because I realised I added +1 to strlen when i did not need to (was afraid it would not fully write a new line command).
Truthfuly you're best bet is it go with something like what I posted or turn it into a function/macro.
#define WriteStrToFile( fid, str ) sceIoWrite( fid, str, strlen(str) )
WriteStrToFile( fd, "test1toto" );