public inbox for linux-msdos@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Cox <theatre@sasktel.net>
To: Vinoth Rajagopal <vinoth124@gmail.com>
Cc: linux-msdos@vger.kernel.org
Subject: Re: How to read and Delete a character from a text file?
Date: Thu, 21 Aug 2008 23:09:11 -0600	[thread overview]
Message-ID: <20080821230911.2cf6079f.theatre@sasktel.net> (raw)
In-Reply-To: <19100322.post@talk.nabble.com>

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

      reply	other threads:[~2008-08-22  5:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080821230911.2cf6079f.theatre@sasktel.net \
    --to=theatre@sasktel.net \
    --cc=linux-msdos@vger.kernel.org \
    --cc=vinoth124@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox