Jul 25, 2008

Handling Byte Streams

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > C/C++ Programming

free web hosting

Handling Byte Streams

kvarnerexpress
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

 

 

 


Reply

SystemWisdom
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..

Reply

dul
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

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : handling, byte, streams

  1. No "safe" Music
    Even Streams can be copied (7)
  2. Simple C File Handling In Action
    Small code snipet which covers most of basic file handling and navigat (3)
    Yesterday I suddenly got a lot of work. The same work we try to push off, yes you are right all
    formalities to get the code review incorporated and update all source code files with code review
    headers. Imagine if you need to open 300 files one by one and append code review headers at the
    end. Since most files are reviewed in groups of 20 to 30 files. We require one header to be placed
    in say 20 to 30 files. To simplify I went back to my class assignment days and wrote this small c
    utility to open all files passed on command line and open attach code review headers an....
  3. Handling Love
    (2)
    mail again... /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> QUOTE
    HANDLING LOVE If you find yourself in love with someone who does not love you, be gentle with
    yourself. There is nothing wrong with you. Love just didn't choose to rest in the other
    person's heart. If you find someone else in love with you and you don't love her/him, feel
    honoured that love came and called at your door, but gently refuse the gift you cannot return. Do
    not take advantage, do not cause pain. How you deal with love is how you deal with you, and....
  4. Free Web Hosting: (byte)
    Free Website: <fused.trap17.com> (1)
    To generate an application for free web hosting please click here: Free Web Hosting Request Form
    I would like to request free web hosting from Trap17. Please find my application below. Your
    Registered Domain Name or Desired Trap17 Subdomain Name: fused.trap17.com Account Username:
    byte Introduction: I'm into graphics, HTML and flash and I've had a couple of
    website's but all on unrealible hosts which are now down. /sad.gif' border='0'
    style='vertical-align:middle' alt='sad.gif' /> Email Address: lukamilic@hotmail.....
  5. Free Football (soccer)
    and other streams..... (1)
    Official Website: http://www.ppstream.com/ Direct Download Link:
    http://www.ppstream.com/bin/ppstreamsetup.exe I used that link/program to watch two streams at the
    weekend (Rangers 0-3 Hibernian and Dunfirmline 0 - 4 Celtic). Both live, and both very good picture
    quality and good sound quality (although the the commentry is foreign language) The sports channels
    are CCTV5 (570K) GUANDONG SPORTS (539K) - labeled ¹ã¶«ÌåÓý SHANGHIGH SPORTS (450K) -
    labeled ÉϺ£ÌåÓý̨ STAR SPORTS (370K) - labeled ÎÀÊÓÌåÓý̨ SHANXXI ESPN (273K) - labeled
    ÉÂÎ÷ÌåÓ....
  6. Handling Forms With Asp
    (0)
    I need Help regarding Forms(feedback, registrations, Uploading files like images) Handling. I came
    across many softwares and scripts that can be very useful for instant development. You can create
    forms and database using these softwares or can inherit the functionality of scripts in your
    existing projects or can even modulate the scripts according to you requirements. But as a beginner
    ASP programmer you want to learn all the coding and all the stuff these softwares do for you in easy
    steps. i have a good knoweledge of programming languages and database, but i have la....
  7. What Does This Error Mean?
    on files and streams (3)
    Can anyone help me with this error? Warning: fopen(guests\guest.txt): failed to open stream:
    Permission denied in /home/leiaah/public_html/images/goguest.php on line 28 Warning: flock():
    supplied argument is not a valid stream resource in /home/leiaah/public_html/images/goguest.php on
    line 30 This is part of the code I wrote // open file for appending $fp =
    fopen("guests\guest.txt", 'a'); flock($fp, LOCK_EX); This works well with my
    offline server but I'm having the error after I published it and when I view it online. Help&....

    1. Looking for handling, byte, streams

Searching Video's for handling, byte, streams
advertisement



Handling Byte Streams



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE