TrevorBradley
Active Member
- Joined
- Nov 6, 2007
- Messages
- 732
I'm trying to figure out a way to read and write plaintext txt files directly from the filesystem using fenix.
I'm aware there are load, save, fopen, fclose functions, but it appears that Fenix strings saved to file are prefixed with a few characters. If I try to read a txt file from the filesystem, the first few characters are removed.
For instance, this code:
CODE
Program SaveTest;
Global
int my_file;
String data;
Begin
my_file=fopen("output.txt",O_READ);
fread(my_file,data);
fclose(my_file);
write(0,0,0,0,data);
Repeat
frame;
Until (key(_enter));
let_me_alone();
exit();
End;
Reads in a txt file containing "0123456789" and prints to the screen: "456789". (I know, the load function does the same thing in far shorter code...)
Is there any way I could read the data directly as plaintext without losing any characters? Perhaps as an array of bytes?
Thanks in advance.
I'm aware there are load, save, fopen, fclose functions, but it appears that Fenix strings saved to file are prefixed with a few characters. If I try to read a txt file from the filesystem, the first few characters are removed.
For instance, this code:
CODE
Program SaveTest;
Global
int my_file;
String data;
Begin
my_file=fopen("output.txt",O_READ);
fread(my_file,data);
fclose(my_file);
write(0,0,0,0,data);
Repeat
frame;
Until (key(_enter));
let_me_alone();
exit();
End;
Reads in a txt file containing "0123456789" and prints to the screen: "456789". (I know, the load function does the same thing in far shorter code...)
Is there any way I could read the data directly as plaintext without losing any characters? Perhaps as an array of bytes?
Thanks in advance.