Write Int???

Blitz3D Forums/Blitz3D Beginners Area/Write Int???

SSS(Posted 2003) [#1]
hi everyone,
im trying to load a level from a level editor i made in blitz into C++ but the WriteInt command outputs something that my C++ cant read, or to my knoledge. Can someone please help me convert it or something comparable... Iv tried writing strings instead of ints and that works but it leaves something at the end of each number

thanks alot


marksibly(Posted 2003) [#2]
Hi,

This should work in C/C++

int bbReadInt( FILE *f ){
int n;
fread( &n,1,4,f );
return n;
}

void bbWriteInt( FILE *f,int n ){
fwrite( &n,1,4,f );
}

...with C++ you might need to use istream::get and ostream::put.

But I would recommned plain old 'C' FILE's for least hassles.


SSS(Posted 2003) [#3]
ok thanks alot :).