CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2005
    Posts
    16

    Question removing heders of the file

    Is there any way to remove the headers of one file .

    I need to remove the headers .

    for example :

    00001 0xdfsd 0xrwe 0xdfg 0xds
    00002 0xdfdf 0xddf 0xdfd 0xfdf
    00003 0xdas 0xfsdf 0xdfd 0xfdf
    ...
    ...
    00001 ,00002 etc are the headers of the file.

    When i read using fread () how to remove the headers only?

  2. #2
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: removing heders of the file

    Quote Originally Posted by rtos
    When i read using fread () how to remove the headers only?
    What do you mean by 'remove'? Do you just want to read the file, but ignore the header? Or do you need to write the file back without the header?

  3. #3
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: removing heders of the file

    Quote Originally Posted by rtos
    00001 0xdfsd 0xrwe 0xdfg 0xds
    00002 0xdfdf 0xddf 0xdfd 0xfdf
    00003 0xdas 0xfsdf 0xdfd 0xfdf
    Strange... Are that the literal contents of the file? Or are those supposed to be hex numbers (as the 0x prefix suggests)? If yes, what are characters like 'r', 'w' and 's' doing there?

  4. #4
    Join Date
    Feb 2005
    Posts
    16

    Re: removing headers of the file

    I want to write the file to another file without header .
    The file is quite big .
    So ,how to write the data only to another file without header?

  5. #5
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815

    Re: removing headers of the file

    Quote Originally Posted by rtos
    I want to write the file to another file without header .
    The file is quite big .
    So ,how to write the data only to another file without header?
    The only straightforward way is to read your file into memory (either entirely or in chunks) and write it back to the new file, starting after the header data. How the end of the header can be found depends on how it is organized - it might have a fixed size (easy) or be structured, so you would need a way to interpret it and find out where it ends.

  6. #6
    Join Date
    Feb 2005
    Posts
    16

    Talking Re: removing heders of the file

    thanks i got the idea now.
    i will try it now.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured