I have a very strange problem when reading a binary file.
void metaDataProcess(FILE *f){
unsigned __int32 obLength;
unsigned __int32 numProp;
char* objPath;
unsigned __int32 rawDataIndex;
int level;
fread(&obLength,sizeof(obLength),1,f);
objPath=new char[obLength];
cout<<"i am at"<<ftell(f)<<endl;
fread(&objPath,sizeof( char),obLength,f);
objPath[obLength]='\0';
cout<<"i am at"<<ftell(f)<<" the object path is "<<objPath<<endl;
level=getOrCreateNode(objPath);
fread(&rawDataIndex,sizeof(rawDataIndex),1,f);
the "objPath" didnt get what is expected in that location. In 010 editor, for that location it is '/', but i read it as '>'. it is quite strange, since from the print out value of ftell, it is the correct position and the value read before and after that are got expected value(obLength=1; and next value rawDataIndex==4294967295).
how come i got '>' when i expceted '/'. i tried fread(&objPath,sizeof(unsigned char),obLength,f); fread(&objPath,1, obLength,f); they are all '>'; can anyone help me with it? thanks
ifstream
? This isn't very C++-y – Cogwheel__int32
is not a standard type nor a valid type you can declare yourself (anything beginning with__
is reserved). C has perfectly standarduint32_t
andint32_t
(and so on) which you should be using. – R.. GitHub STOP HELPING ICE