Changing header data in binary file

This is a discussion on Changing header data in binary file within the C Programming forums, part of the General Programming Boards category; The lab I work in collects EEG data into binary files and use a particular program to view and analyze ...

  1. #1
    Registered User
    Join Date
    Nov 2008
    Posts
    2

    Changing header data in binary file

    The lab I work in collects EEG data into binary files and use a particular program to view and analyze it, so I've been tasked to convert the data so another similar analysis program can accept it. The data itself(microvolt values) is stored in the same way for both programs, multiplexed(ie record 0 stores the first value for all the channels, and record 1 stores the next value for all the channels, etc), but have slightly different header data that describes things like how many channels, experiment name, etc.

    I'm rather new to programming, and so I'm looking for information as how to get started. Like ways to read and write binary data, change an existing file, handling c structures. I know I learn best by doing, but I know picking up a few rather dense books on C wont help.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,535
    Do you have documentation which describes the two file formats?
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    If you know more about how the formats are laid out, I am sure one of us would be happy to just write out some quick code for you if its not to much work (which is my subtle way of saying I am trying to avoid my psych homework).

  4. #4
    Registered User
    Join Date
    Sep 2008
    Location
    California
    Posts
    19
    These sound like a form of FITS files, only used to hold information in a binary table form. Does that ring any bells? If so, I can provide some help; I work with them a lot.

  5. #5
    Hacker MeTh0Dz's Avatar
    Join Date
    Oct 2008
    Posts
    111
    Quote Originally Posted by master5001 View Post
    If you know more about how the formats are laid out, I am sure one of us would be happy to just write out some quick code for you if its not to much work (which is my subtle way of saying I am trying to avoid my psych homework).
    I know the feeling, except insert Cisco, Physics or Calculus.

  6. #6
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    See now math and science stuff I use as an excuse to procrastinate at work. I have a system worked out.

    if school = b + n; where b is boring subjects, and n is non-boring subjects
    if work = s + f; where s represents stupid assignments, and f fun ones

    then my_day = school + work

    = school + work
    = (b + n) + (s + f)

    BUT I have found that sometimes its better if I sub in n for s and f for b

    = (f + n) + (n + f)
    = 2(f + n)

    Which means twice the fun/interesting stuff, and no bordem and stupidty. At least according to my rules of math, anyway.

  7. #7
    Registered User
    Join Date
    Nov 2008
    Posts
    2
    Well here are the header files and documents. They are labeled A and B, since I want to convert from A to B.
    Attached Files Attached Files

  8. #8
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    If I'm reading your documents correctly, they both use the same header format as well (ERP format, whatever that actually turns out to be).

  9. #9
    Hacker MeTh0Dz's Avatar
    Join Date
    Oct 2008
    Posts
    111
    Quote Originally Posted by master5001 View Post
    See now math and science stuff I use as an excuse to procrastinate at work. I have a system worked out.

    if school = b + n; where b is boring subjects, and n is non-boring subjects
    if work = s + f; where s represents stupid assignments, and f fun ones

    then my_day = school + work

    = school + work
    = (b + n) + (s + f)

    BUT I have found that sometimes its better if I sub in n for s and f for b

    = (f + n) + (n + f)
    = 2(f + n)

    Which means twice the fun/interesting stuff, and no bordem and stupidty. At least according to my rules of math, anyway.
    Lol, I like that equation.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. reading binary file with different data types
    By larne in forum C Programming
    Replies: 8
    Last Post: 07-29-2008, 10:12 AM
  2. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM
  3. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM
  4. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 02:58 PM

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