Results 1 to 2 of 2

Thread: Reading binary data in C++

  1. #1
    Senior Member
    Join Date
    Jul 2001
    Posts
    280

    Reading binary data in C++

    I'm trying to write a program to read a binary file. Everything is divided into 4-byte segments. I'm using the Qt libraries, FYI. What would be the best way to read in the information and then convert that into what ever form it needs to be in (like a string or an integer)? Thanks.

  2. #2

    Re: Reading binary data in C++

    Read in 4 unsigned chars at a time (4 bytes), then manipulate them (remember byte ordering if necessary). Cast them as appropriate, etc. You could use an unsigned char array, fill it from an fstream, etc. Should be easy.

Similar Threads

  1. What are you reading?
    By halfpipe10 in forum General Chat
    Replies: 2
    Last Post: 02-11-2006, 03:33 AM
  2. reading .html and not .php
    By pinehead in forum Linux - General Topics
    Replies: 4
    Last Post: 11-23-2002, 06:09 PM
  3. Binary Clock
    By gmoreno in forum General Chat
    Replies: 8
    Last Post: 06-01-2002, 02:46 PM
  4. CD-ROM reading
    By dgwebstuff in forum Linux - General Topics
    Replies: 11
    Last Post: 05-24-2002, 03:10 AM
  5. binary or source ?
    By boblucci in forum Linux - General Topics
    Replies: 6
    Last Post: 01-22-2002, 08:26 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •