|
-
Mar 29th, 2002, 02:58 PM
#1
Thread Starter
New Member
writing to beginning of file
using the
"open "c:\bla.txt" for append as #1 etc"
inputs the string at the end of the file
however, for my purpose it needs to be at the beggining of the file? how do i do this?
also how do i then remove this string from the beginning and restore it to it's original state?
the basic idea is to corrupt a file so it is unreadable and then uncorrupt it
cheers
-
Mar 29th, 2002, 02:59 PM
#2
your appending which means your adding to an existing file...try using input.
-
Mar 29th, 2002, 03:00 PM
#3
-
Mar 29th, 2002, 03:01 PM
#4
Thread Starter
New Member
no but whatever method writes to the end of the file. i NEED to write to the beginning but have no idea how
-
Mar 29th, 2002, 06:40 PM
#5
VB Code:
Dim strFile As String 'the exisiting file
Dim strNewInfo As String 'the new stuff to save
' Add the contents of the file to a
' string variable.
Open "C:\TestFile.txt" For Input As #1
strFile = Input(LOF(1), 1)
Close #1
' Open the file and write the new information
' to the file followed by the old information.
Open "C:\TestFile.txt" For Output As #1
Print #1, strNewInfo & vbCrLf & strFile
Close #1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|