Problem reading a certain sized integer into a value from a file.

This is a discussion on Problem reading a certain sized integer into a value from a file. within the C++ Programming forums, part of the General Programming Boards category; So is there a "Safe" strategy to resolving the problem. Essentially I'm the only one going to be using this ...

  1. #16
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    So is there a "Safe" strategy to resolving the problem. Essentially I'm the only one going to be using this class, and most of the files generated are similar.

  2. #17
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    It really depends on the usage of the data. If all you ever do with it is, on the same computer architecture, write out files and read them back in, you can use the simplest format you can come up with.

    If you want to exchange data with other architectures, that's where the trouble starts.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #18
    Ethernal Noob
    Join Date
    Nov 2001
    Posts
    1,901
    ok ok ok, I think i was reading the data wrong in the loop. Little endian means if I have a value such as

    0F FD;

    then the resulting number will be

    FD0F right. No wonder the other values were reading correctly when I read them.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 01:13 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 07:39 AM
  3. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 10:54 AM
  5. Problem reading file
    By winsonlee in forum C Programming
    Replies: 2
    Last Post: 04-23-2004, 07:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21