Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Handling Byte Streams

Recommended Posts

I am writing a program that needs to read/write to blocks on a floppy disk. I am using two functions (written by someone else) that are defined as follows:


Code:

int WriteBlock(int index, BYTE *buffer, int count);int ReadBlock(int index, BYTE *buffer, int count);

I am making a call to ReadBlock() as follows:
Code:

BYTE record_stream[512];ReadBlock(some_index,&record_stream,1);


My problem is that when I compile I get the following error:

Code:

no matching function for call to `disk::ReadBlock(int, BYTE (*)[512], int)'candidates are: int disk::ReadBlock(int, BYTE*, int)



Not having very much experience with BYTE streams I am just treating them like char arrays. My questions are:
1-Am I right to think of BYTE arrays as being similar to char arrays?
2-(more importantly)How am I supposed to properly send in a BYTE array to this function? Do I need to create the BYTE array on the heap possibly?

Anyways, thanks in advance for any help.
kvarnerexpress

Share this post


Link to post
Share on other sites

Try to remember that arrays are pointers already, and thus you shouldn't need to pass the address of your variable to the function..

Try something like:

BYTE record_stream[512];ReadBlock(some_index, record_stream, 1);

I hope that helps a bit..

Share this post


Link to post
Share on other sites

BYTE record_stream[512];ReadBlock(some_index,&record_stream,1); Bur record_stream must be record_stream[255] try. Byte's maximum size is 255. I mean You can not use longer than 255 Length. Good luck

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.