Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing a file header

Status
Not open for further replies.

wanmaster

Programmer
Nov 20, 2000
94
NL
I have to remove a header of a file.
Is there a quick way to do that??

Remedy
 
what kind of file? most file header's I've seen have an offset value that tells you where the raw data begins.. you could read in this value and then strip the rest of the file using many different techniques...
 
It's a wave file. Luckely, the length of the headers of the files I need to chop the header of is always 57 bytes.

I thought of using the CreateFile and WriteFile functions to make a copy of the file and using SetFilePointer to move the pointer 57 bytes.

Reading the file and moving the pointer works fine.
The only problem I have is to save the file again (under a different or the same filename). Because WriteFile requires a string to be written to the new file, and I don't want to read the complete file into a string and then write the string. I'm trying to find out if I can use the handle of the 'chopped' file to save it directly.

Remedy
 
hmm... almost sounds like you're trying to strip the header without copying anything, for speed?... you said you don't want to read the complete string, but a buffer loop is pretty fast...

I do remember reading about an API that was called "StripFileHeader" (or something to that effect) -- but I don't know for what kind of files this was for or if it's what you're looking for... You might find something by researching File API's... I'm going to try find it again myself.
 
Thankx.
Actually, it's to convert a normal wave file into raw-pcm a-law file format. That's pretty much like a normal wave-file, but without the header-information (and some other small differences).

Remedy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top