How to read text made by fwrite

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
cameron
Posts: 794
Joined: June 26th, 2012, 5:38 pm
Location: USA

How to read text made by fwrite

Post by cameron » December 17th, 2012, 2:16 am

This is the text fwrite creates for my shipgame save file. How do I read it?


ˆ ÃC € D s s‡ s‡ † & † & † & ÃC ÃC ÃC ÃC ÃC ÃC ÃC ÃC ÃC € D € D € D € D € D € D € D € D € D¤ Y d ¸ n U R ˆ _ €—CX3AC €—CB³ŒC C ™0C C C GC ™8C GC €ƒC @=D03B @=D C B03·B B *C ¢C ™$C ¢C sC ŒC03B ŒC C °A03ËB °A 4C €õC`fRB €õC C €D03õB €D IC qC03±B qC 'C øB03­B øB %C ÌB ™#C ÌB rC €‚C ™QC €‚C C @D ™/C @D ~C §C`f^B §C C ½C ™bC ½C €˜C C`fbB C C øB03ùB øB KC ¶B ™ C ¶B oC €³C03ûB €³C LC €ÂC ™C €ÂC ]C ¼B03ÝB ¼B =C €àC ™WC €àC “C pA03«B pA $C @1D ™BC @1D €ˆC þC`frB þC C 4D`f2B 4D æB ±C03ÁB ±C /C æC ™dC æC €™C §C ™=C §C †C ÐB ™6C ÐB €‚C €ÆC03½B €ÆC -C pA ™ZC pA €”C @2D ™OC @2D C €ÀC03§B €ÀC "C D ™]C D –C €üCš™C €üC QC fC ™:C fC €„C €D03÷B €D JC €åC`f2B €åC èB @D`f2B @D èB @8D ™&C @8D uC B03ËB B 4C ÀD ™\C ÀD €•C C ™C C `C D ™`C D €—C À2D03B À2D C €›C03“B €›C C À-D™C À-D UC €üC`fBB €üC þB $C ™C $C hC À4D ™dC À4D €™C B ™iC B œC NC ™-C NC |C C ™BC C €ˆC çC03§B çC "C €D`fJB €D C €D ™6C €D €‚C ˆB ™PC ˆB €C C03ËB C 4C C03óB C HC C ™ZC C €”C D ™;C D …C C ™bC C €˜C ^Cœ™C ^C SC €D03ßB €D >C °B ™!C °B pC C ™PC C €C yC ™JC yC €ŒC €ÍC03½B €ÍC -C D ™C D aC À5D ™WC À5D “C @4D ™ZC @4D €”C €ƒC ™DC €ƒC €‰C C ™

. . .

And so on... A million characters.
Computer too slow? Consider running a VM on your toaster.

User avatar
LuX
Posts: 1492
Joined: April 22nd, 2012, 12:33 pm
Location: Finland

Re: How to read text made by fwrite

Post by LuX » December 17th, 2012, 2:42 pm

Firs of all, I cropped down your text a little.

But yeah, to read files I think chili made a tutorial about it once. Other than that you would need to prepare the file to be read and then read it.

Something along the lines of ( copypasted from stackoverflow):

char getdata[10000];
infile.read(getdata, sizeof getdata);
if (infile.eof())
size_t bytes_really_read = infile.gcount();

Should read the 10000 first characters. Search on the net or wait for a more helpful person to answer.
ʕ •ᴥ•ʔ

Post Reply