|
-
Aug 27th, 2007, 01:23 AM
#1
Thread Starter
Addicted Member
[RESOLVED] could u say "how to write data in a specific line of a file"?
Hi every body,
Till now i have used "Files" concept in V.B for many times. but i don't know how to write data in a specific line.
till now how i wrote was like the following sentence.
print #iFileNo,strStudentName
If you know how to do this, kindly let me know it..
Thanks:
regards:
raghunadhs.
-
Aug 27th, 2007, 03:17 AM
#2
Re: could u say "how to write data in a specific line of a file"?
What i normally do is,
assume you have a file call a.txt with 10 lines.
so you want inset a line in to the 5th line.
You read the lines of a.txt using a loop and write top 4 lines in to a new file call b.txt . when the loop reached the 5th line, you write your new line in to the b.txt and write the rest of the lines in to b.txt as you wrote the top 4 lines.
After writing all the lines, you just delete a.txt and rename b.txt to a.txt.
I dont know any other direct solutions are there. You can use this as a temporary solution.
-
Aug 27th, 2007, 04:26 AM
#3
Thread Starter
Addicted Member
Re: could u say "how to write data in a specific line of a file"?
Thanks Fazi,
i will follow up your suggestion...
Thanks:
regards:
raghunadhs.
[QUOTE=Fazi]What i normally do is,
assume you have a file call a.txt with 10 lines.
so you want inset a line in to the 5th line.
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
|