Using BinaryReader with a structure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to read a file into a structure, called LogFile, but the compilier issues error message: error C2228: left of '.ReadBytes' must have class/struct/union typ

Can anyone spot what is wrong with this declaration

Thanks
Ji

int LoadLog(char * path


struct dumpD // format of the dump file

char Header[3]
char Log[13]
}

dumpD LogFile[32768];

FileStream* logfile = new FileStream(path,FileMode::Open,FileAccess::Read);
BinaryReader* br = new BinaryReader(logfile)
LogFile[0] = br.ReadBytes(32768)
 
JimM said:
I'm trying to read a file into a structure, called LogFile,
but the compilier issues error message: error
C2228: left of '.ReadBytes' must have class/struct/union type

Can anyone spot what is wrong with this declaration?
...
FileStream* logfile = new FileStream(path,FileMode::Open,FileAccess::Read);
BinaryReader* br = new BinaryReader(logfile);
LogFile[0] = br.ReadBytes(32768);

Try

br->ReadBytes(32768);

Regards,
Will
 
Back
Top