Thread: Help with tables in C++

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    4

    Help with tables in C++

    Hi,

    How can I create a table of hex numbers and store it in memory so that I could read and write from and to the table easily? Or is it just easier to create a text file and use the I/O commands to read and write? How about just creating an array of hex numbers and going through that?

    I am looking for the simplest way possible because this is part of a bigger project.


    My table contains 4 digit hex numbers (like 123A) in each row and a total of 1024 rows all in one column.


    I am new to C++ programming and would appreciate any help.

    Thanks,

    Ryan

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    It's all hex (or binary) at the machine level.
    'base' is just a convenient representation for the user. There is nothing magic about this.

    Code:
    int array[10] = { 1024, 2048 };
    is no different to
    Code:
    int array[10] = { 0x0400, 0x0800 };
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. CPU increase with precomputed tables?
    By since in forum C++ Programming
    Replies: 17
    Last Post: 11-20-2009, 08:51 PM
  2. C++ style tables
    By MarkZWEERS in forum C++ Programming
    Replies: 4
    Last Post: 05-18-2009, 08:41 AM
  3. Iterable hash tables
    By OnionKnight in forum Tech Board
    Replies: 5
    Last Post: 07-21-2008, 02:02 AM
  4. String tables in console apps
    By Sentral in forum C++ Programming
    Replies: 3
    Last Post: 10-16-2006, 04:08 AM
  5. Help with beginning hash tables, please.
    By Will in forum C++ Programming
    Replies: 8
    Last Post: 11-17-2002, 09:51 PM

Tags for this Thread