943,846 Members | Top Members by Rank

Ad:
Aug 29th, 2005
0

Append to beginning of file

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
clam is offline Offline
4 posts
since Aug 2005
Aug 31st, 2005
0

Re: Append to beginning of file

I may be missing something but why not write the header data to a second file then append your data to it?
Reputation Points: 16
Solved Threads: 19
Practically a Master Poster
Thong_Ispector is offline Offline
638 posts
since Nov 2004
Aug 31st, 2005
0

Re: Append to beginning of file

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?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
clam is offline Offline
4 posts
since Aug 2005
Sep 2nd, 2005
0

Re: Append to beginning of file

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 ?
Reputation Points: 16
Solved Threads: 19
Practically a Master Poster
Thong_Ispector is offline Offline
638 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Trying to Exit Progam Cleanly
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Newbie Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC