Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

save binary data to file

Name: Anonymous 2007-09-17 1:06 ID:RgM63GYu

How do I do this C, C++?

I want to save a lot of ints, and I know that they only take up 32Bits (i think) but I'm using a string like " 2105601606 1065160 5610651"  to store these goddam fuckers

he;lp?

Name: Anonymous 2007-09-17 1:13 ID:HaebAsS3

>>1
learn C.. this kind of thing is trivial once you know the language

Name: Anonymous 2007-09-17 1:18 ID:2t8Vc6yQ

sorry C and C++ lives in silicon valley, they are travelling round the world at the moment, come by later

Name: Anonymous 2007-09-17 1:43 ID:SLzEHuzc

fopen and fputs i think are the only functions you need to know, and fclose. C doesn't distinguish between binary and text files, though i haven't learnt about binary files, i assume they're the same

Name: Anonymous 2007-09-17 4:23 ID:0tEI30SY

ALL FILES ARE BINARY FILES YOU JACKASSES

Name: Anonymous 2007-09-17 5:10 ID:ywQ9YXTJ

Read the fread(3) and fwrite(3) man pages. Write some code. Learn about endianness. Cry. Read the htonl(3) and ntohl(3) man pages.

Name: Anonymous 2007-09-17 5:22 ID:Heaven

I want to save a lot of ints, and I know that they only take up 32Bits (i think)
System dependant.

Name: Anonymous 2007-09-17 5:42 ID:TSsFOobl

>>1
Read K&R (also read SICP)

>>5
This man understands his trade.

Name: Anonymous 2007-09-17 6:00 ID:mMIoy75Z

>>8
I have it. might go and dig it up now

Name: Anonymous 2007-09-17 6:31 ID:Heaven

Name: Anonymous 2007-09-17 7:22 ID:/MQ/cjnb

>>7
I want to save a lot of ints, and I know that they only take up 32Bits (i think)
System dependant.
Use uint32_t from stdint.h.

Name: Anonymous 2007-09-17 7:25 ID:Heaven

>>11
Not supported by many implementations.
but yes, use (u)intN_t for fixed length objects.

Name: Anonymous 2007-09-17 13:33 ID:V6jzWRye

>>12
Use UNITIИU for fixed length objects.

Name: Anonymous 2011-02-04 12:25

Don't change these.
Name: Email:
Entire Thread Thread List