Writeing save files
Another question, hopefully an easy one, how do you make your program make a save file that is not readable, or editable?? Like the ones that have machince code it it, hopefully I asked my question right hehe.
Thx Jeff D
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
Suffered seven plagues, but refused to let the slaves go free. ~ Ross Atherton
quote: Original post by Jeff D
Another question, hopefully an easy one, how do you make your program make a save file that is not readable, or editable??
That''s not possible in any computing environment I know of.
quote: Original post by Jeff D
Like the ones that have machince code it it, hopefully I asked my question right hehe.
Those are still completely editable. However, since they''re just binary data they''re unintelligable without some information on their design or some effort on finding it out yourself. Here''s an example in C that shows how to write a number and then four characters to a file in binary:
#include <stdio.h>#include <stdlib.h>int main(void) { FILE *File; int Num = 123456; char Char[4] = { ''a'', ''b'', ''c'', ''d'' }; File = fopen("Output.dat","wb"); if(File == NULL) { fprintf(stderr,"Error creating file.\n"); return -1; } if(fwrite(&Num,sizeof(int),1,File) != 1) { fprintf(stderr,"Error writing Num.\n"); } if(fwrite(Char,sizeof(char),4,File) != 4) { fprintf(stderr,"Error writing Char.\n"); } fclose(File); return 0;}
As I understood, you want a save file with binary code instead of text code, right ? It means that the information will be there but you will not see 126 as a number but as a binary value...OK! Use header and functions
functions -
int Handle;
open(-filename-,params);
read(-handle-, &variable, -size in bytes-);
write(-handle-, &variable, -size in bytes-);
see help
functions -
int Handle;
open(-filename-,params);
read(-handle-, &variable, -size in bytes-);
write(-handle-, &variable, -size in bytes-);
see help
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement