Thread: need Help! reading a binary file

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    10

    Question need Help! reading a binary file

    Hi guys, I have question. I haven’t program in c++ in over 5 years last time I was programming I was learning the langrage in school. I now have jump back into programming in c++ and i am trying to make a program that would be able to read a binary file and get the data from it. so i can save it to a text file.

    Code:
    
    
    This is how the data is structured.
    
    ------------------------------------------------
    Size (Bytes)  	     Name  	      Type  	      Description
    -------the structure of the file--------------------------------------------
      4 	                         Signature 	  char[4] 	    File Signature ('logi') no terminating null
      4 	                         version 	    uint32 	      File Format Version
      4 	                         count 	      uint32 	      Number of entries that follow
    
    Variable 	entries
    -----------------------------------------------------
    1 	              namelenth 	uint8 	      Length of name
    namelenth 	      name 	      char[] 	      name (nameLength characters) no terminating null
    6 	              id 	        uint8[6] 	    HEXVALUE   
    8                 FILETIME    FILETIME      100-nanosecond increments since January 1, 1601 (UTC). 64-bit integer
    ------------------------------------------------------------------------
    
    
    here is a hex example of the file(paste it in to your hex editor and save it)
    ------------------------------------
    6C6F676905000000010000000D5468697369737468656E616D65000A11F1D11160992BFCD425C901
    ------------------------------------
    
    Lets break it down
    ----------------------------------------------------------
    
    6C6F6769 = logi                                Signature
    05000000 = 5                                    version
    01000000 = 1                                    count
    ----------------------------------------------------------
    
    0D = 13                                         namelenth
    5468697369737468656E616D65 =  Thisisthename     name
    000A11F1D111 = 000A11F1D111                     HEXVALUE  hex value of name 
    60992BFCD425C901 = 3:55:05 AM  10/4/2008        FILETIME
    ----------------------------------------------------------
    
    Signature = logi
    version = 5
    count = 1
    namelenth = 13
    name = Thisisthename
    HEXVALUE = 000A11F1D111
    FILETIME = 3:55:05 AM  10/4/2008
    
    ---------------------------------------
    I can not change the format of the file it has already been set a long time ago.

    I am not looking for anybody to do this program for me I am just trying to be point in the
    Right direction.

    By the way I don’t have access to visual studio.net IDE

    Currently I am using the free IDE "Bloodshed Software - Dev-C++"

    I need to make this program work with Linux and windows. windows whould be fine right now and it has to be in c/c++

    Any help will be greatly appreciated. thank you.

    --------------------------------------------------------------------------------
    Last edited by d4rksid3; 10-16-2008 at 12:34 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Binary Tree - Reading From and Writing to a File
    By Ctank02 in forum C++ Programming
    Replies: 2
    Last Post: 03-15-2008, 09:22 PM
  2. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 10:46 AM
  3. Problem reading a delimited file into a binary tree
    By neolyn in forum C++ Programming
    Replies: 10
    Last Post: 12-09-2004, 07:51 PM
  4. Reading data from a binary file
    By John22 in forum C Programming
    Replies: 7
    Last Post: 12-06-2002, 02:00 PM
  5. reading from structs in a binary file
    By Unregistered in forum C Programming
    Replies: 4
    Last Post: 12-21-2001, 10:52 AM

Tags for this Thread