| | |
Append to beginning of file
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Aug 2005
Posts: 4
Reputation:
Solved Threads: 0
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
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
•
•
Join Date: Aug 2005
Posts: 4
Reputation:
Solved Threads: 0
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?
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 ?
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 ?
![]() |
Similar Threads
- append to XML file (Visual Basic 4 / 5 / 6)
- how should i append data to file by overwriting the one's already existing? (Java)
- Having problems with a file type (Geeks' Lounge)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: Trying to Exit Progam Cleanly
- Next Thread: Newbie Help
| Thread Tools | Search this Thread |
Tag cloud for Visual Basic 4 / 5 / 6
* 6 429 2007 access activex add age append application basic beginner birth bmp calculator cd cells.find click client code college column component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report retrieve save search sendbyte sites sort sql sql2008 sqlserver subroutine table tags textbox time timer urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





