Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Replacing characters in a txt file

Author
Message
ithilgore
22
Years of Service
User Offline
Joined: 1st Oct 2002
Location:
Posted: 15th Sep 2004 22:12
What I was searching lately was to make a program which reads all the numbers from a file and writes a new one with the numbers being added a +1 or -1.
for example if the original file contained a number 12 the new file would replace that with a 11. i know how to use file commands but i am not aware of how the ascii system works to do that kind of programme.
(this programme will actually read guitar tablature txt files and move them different tunes up or down)
Lukas W
21
Years of Service
User Offline
Joined: 5th Sep 2003
Location: Sweden
Posted: 15th Sep 2004 22:22
oh! cool! I was planning on making a tablauture program too, but I never started it!

well I guess you should do it like this:

open to read 1,file$
read string 1,T$
chars = len( T$ )
for x = 1 to chars
value = val( mid$( T$, x ) )
value = value - 1
open to write 2,file$
write string 2, str$( value )
close file 2
next x
close file 1


dont know if this is what you asked for but It replaces one number in a file with a lower number.. (dont know if it works either )


I am not cool anymore... or am I?
http://n0id.proboards28.com/index.cgi - please join
Dot Merix
21
Years of Service
User Offline
Joined: 15th Oct 2003
Location: Canada
Posted: 15th Sep 2004 23:21 Edited at: 15th Sep 2004 23:22
I just posted a tutorial on this

http://forum.thegamecreators.com/?m=forum_view&t=39145&b=7

I think this is somewhat what your looking for?

- Merix
PiratSS
22
Years of Service
User Offline
Joined: 18th Oct 2002
Location:
Posted: 16th Sep 2004 00:55 Edited at: 16th Sep 2004 00:55
Or like this noid:

ithilgore
22
Years of Service
User Offline
Joined: 1st Oct 2002
Location:
Posted: 16th Sep 2004 05:10
actually neither works
the result was:
-1
-1
-1
-1
...
it seems there is some kind of problem -it reads the first string, makes it into numbers of the particular value of -1 instead of saubtracting from the original :/

Login to post a reply

Server time is: 2024-11-27 09:42:12
Your offset time is: 2024-11-27 09:42:12