Hi Guys.

Basically I was wondering if it is possible to Append to the START of the file, instead of the end?

For a bit of background information, I have a lump of raw data in hex (they are samples collected from a microphone on a microcontroller then transferred to the PC via RS232). I was planning on dumping them straight into a file, then adding some .wav header information to the beginning of the file, then THEORETICALLY i should be able to use it as a normal .wav file. Does anyone see a problem with this?

Anyway, thanks for any input.

Cheers,

clam

I may be missing something but why not write the header data to a second file then append your data to it?

I was just about to post explaining that, sorry.

I tried it:

Open filename For Input As #1
Open filename2 For Append As #2

Write #2, "WAVE HEADER INFORMATION"

Dim templine As String

Do Until (EOF(1) = True)
Input #1, templine
Write #2, templine
Loop

Close


The first file is 186kb, and after adding header information (currently just "WAVE HEADER INFORMATION") then appending all of the first file to the second.... the second file is only 85kb

I assume this is because the entire file is on one line or something?

Sorry I did not get back sooner..
I ran that after making text files and it worked fine.

My file size doubled and all of the info was inside.

The size on disk remained the same... but the data size increased correctly..

I am also interested in your code for saving the raw file to disk.

Are you using VB5 or ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.