Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Handling Byte Streams
kvarnerexpress
post Oct 2 2005, 09:04 PM
Post #1


Super Member
*********

Group: Members
Posts: 407
Joined: 13-December 04
Member No.: 2,696



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:
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:

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



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

Code:

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

Go to the top of the page
 
+Quote Post
SystemWisdom
post Oct 3 2005, 01:17 AM
Post #2


Advanced Member
*******

Group: Members
Posts: 117
Joined: 3-May 05
From: A Canadian South of the 49th Parallel
Member No.: 6,544



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:
CODE

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


I hope that helps a bit..
Go to the top of the page
 
+Quote Post
dul
post Oct 4 2005, 12:07 AM
Post #3


Member [Level 1]
****

Group: Members
Posts: 73
Joined: 21-September 05
Member No.: 12,113



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
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Simple C File Handling In Action(4)


 



- Lo-Fi Version Time is now: 11th October 2008 - 02:59 AM