[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.
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.
:)
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.