Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 5:55 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: how to write to text file
PostPosted: March 13th, 2011, 4:26 pm 
Offline

Joined: September 11th, 2006, 2:38 pm
Posts: 125
hi all
I have a file called data.txt
the file has many lines.
I can add new line to the file by using
txtObj.GotoNextLine()
txtObj.WriteLine("hello world!")

this is work fine. but what I want is:
suppose that I have 5 lines in the txt file

line1
line2
line3
line4
line5

NOW I want to add "hello world" after the line 4 and before the line 5
this is the whole story.
I appreciate any help.

_________________
Win windows 7
Opus Pro 9.5


For this message opuslover has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: how to write to text file
PostPosted: March 19th, 2011, 4:43 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
There is probably a much more elegant way than this idea, but one way is to read from the file, one line at a time, 1,2,3,4 and write line by line to a new file(data.txt... in a different directory), then add the new line, 5, then the other lines 5,6,7, from data.txt, finally overwrite the old file with the new one......or something like that, very clunky.

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 21 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group