Thread: Read all Data from Device

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    6

    Read all Data from Device

    Hi,

    my target is too read all Data from a device ((block is more important than char, but best would be a solution that works on both))
    Can u tell me wich funktion i should use?
    I tried fread first, but i think there is a Problem with EOF or Newlines.
    Code:
            
    while (fread(&buffer, 1, 1, fp) == 1) {
                   //CODE
    }
    Greetings,
    hd


    (Ps.: after that i want to make a md5checksum with mhash of the hole device, but the following code didnt generate the same checksum for a Device, but it does for a small textfile)
    Code:
    while (fread(&buffer, 1, 1, fp) == 1) {
                   mhash(td, &buffer, 1);
    }

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    You want:

    buffer, instead of &buffer

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bytes lost with partial read in UDP
    By mynickmynick in forum Networking/Device Communication
    Replies: 3
    Last Post: 03-31-2009, 02:06 AM
  2. Reading raw device data
    By zacs7 in forum Linux Programming
    Replies: 10
    Last Post: 05-09-2007, 03:19 PM
  3. I need help as soon as possible.
    By hyrule in forum C++ Programming
    Replies: 7
    Last Post: 11-09-2005, 05:49 PM
  4. read data from file
    By matth in forum C++ Programming
    Replies: 3
    Last Post: 04-21-2005, 09:37 AM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 10:52 AM