473,326 Members | 2,182 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Using BinaryReader with a structure


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)


Nov 17 '05 #1
1 3336
"JimM" <an*******@discussions.microsoft.com> wrote in message
news:FD**********************************@microsof t.com...
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
Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Willem van Rumpt | last post by:
Hi all, coming from an unmanaged programming background, I took my time to sort out the IDisposable and finalizer patterns. Just when I thought I had it all conceptually neatly arranged, the...
2
by: Bob Rock | last post by:
I already found an alternative way to accomplish this (using ReadBytes), still I'd like to understand why I'm getting and error reading a text file using the following method. The exception is...
6
by: Question with BinaryReader | last post by:
I use BinaryReader to read my binary dafa files, when i call ReadBytes, why it always return more 4 bytes. The following is my code. FileStream fs = new FileStream(file, FileMode.OpenOrCreate,...
1
by: Vitaly | last post by:
// Open input file and create the BinaryReader. br = new BinaryReader(new FileStream("Test.dat", FileMode.Open, FileAccess.Read)); // Read binary data. d = br.ReadDouble(); A question is...
0
by: mag | last post by:
Let's start off by saying I'm a noob to .Net but here's my problem. I have many files, all with the same structure. I know the structure, It was written in some version of C++. Because it seem...
5
by: Anil Gupte | last post by:
I am learning how to read and write files. Text files were easy, but binary files have me confused. As per the tutorial, I used BinaryReader to read a file and put the contents into a ByteArray:...
15
by: tshad | last post by:
Do I still need to close an object in a finally statement after a catch if it is part of a using statement? For example: FileStream fs = null; try { using (FileInfo fInfo = new...
2
by: tshad | last post by:
I tried to put multiple objects in one using statements like so: using (fs = new FileStream(fromImagePath + "\\" + (string)dr, FileMode.Open, System.IO.FileAccess.Read) , BinaryReader br = new...
3
by: =?Utf-8?B?VmljdG9y?= | last post by:
Hi, Could you tell me can I keep the MemoryStream open and "close" the BinaryReader? As the MemoryStream is used for buffering the TCP data and BinaryReader is only used to read the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.