public inbox for linux-msdos@vger.kernel.org
 help / color / mirror / Atom feed
* How to read and Delete a character from a text file?
@ 2008-08-22  2:24 Vinoth Rajagopal
  2008-08-22  5:09 ` Frank Cox
  0 siblings, 1 reply; 2+ messages in thread
From: Vinoth Rajagopal @ 2008-08-22  2:24 UTC (permalink / raw)
  To: linux-msdos


Hi Friends,

I need to your help with resolving this issue.

Actually I need to open a text file (D:\a.txt) and I need to read that file
character by character. When the Character count reaches 226 I need to
delete that character. An then I need to start my count from next chracter. 

Is it possible to perform in DOS....

Please help me to resolve this issue...

Thanks In Advance 

Thanks,
Vinoth
-- 
View this message in context: http://www.nabble.com/How-to-read-and-Delete-a-character-from-a-text-file--tp19100322p19100322.html
Sent from the linux-msdos mailing list archive at Nabble.com.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to read and Delete a character from a text file?
  2008-08-22  2:24 How to read and Delete a character from a text file? Vinoth Rajagopal
@ 2008-08-22  5:09 ` Frank Cox
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Cox @ 2008-08-22  5:09 UTC (permalink / raw)
  To: Vinoth Rajagopal; +Cc: linux-msdos

On Thu, 21 Aug 2008 19:24:01 -0700 (PDT)
Vinoth Rajagopal <vinoth124@gmail.com> wrote:


> Actually I need to open a text file (D:\a.txt) and I need to read that file
> character by character. When the Character count reaches 226 I need to
> delete that character. An then I need to start my count from next chracter. 
> 
> Is it possible to perform in DOS....

I'm not sure if you can perform that feat using just command.com and a batch
file.

However, the "stock" dosemu comes with bwbasic, a basic interpreter that can
certainly do what you're looking for.

Here is an untested bwbasic program:

10 open "R",1,"a.txt",1
20 field #1, 1 as a$
30 open "O",2,"b.txt"
40 for x = 1 to 225
50 if eof(1) then 110
60 get #1
70 print #2, a$;
80 next x
90 if not eof(1) then get #1
100 goto 40
110 close 1,2
120 kill "a.txt"
130 name "b.txt" as "a.txt"
140 end

You can run this from the command line by saving it as a dos-formatted text
file, then using this command:

bwbasic program.bas

where program.bas is the name of the program text file.

Note that I haven't really tested this little program  except to insure that
it runs and doesn't hang in an infinite loop.  It may not work at all for your
purpose as presented here.  Experiment with it and edit it to suit your needs.

-- 
MELVILLE THEATRE ~ Melville Sask ~ http://www.melvilletheatre.com

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-22  5:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-22  2:24 How to read and Delete a character from a text file? Vinoth Rajagopal
2008-08-22  5:09 ` Frank Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox