Qbasicnews.com
April 09, 2020, 07:02:48 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: txt or .dat files  (Read 1407 times)
andy
Senior Member
**
Posts: 175



WWW
« on: April 16, 2004, 05:53:16 AM »

if I have a txt file like this


1,1,1,1,1,1
1,2,3,3,2,1
1,4,4,3,4,1
1,3,4,6,5,1
1,1,1,1,1,1


how can I open this file change middle 4 on the 3rd line to a 7
like this

1,1,1,1,1,1
1,2,3,3,2,1
1,4,7,3,4,1
1,3,4,6,5,1
1,1,1,1,1,1

without rewritting the entire file
Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
na_th_an
*/-\*
*****
Posts: 8244



WWW
« Reply #1 on: April 16, 2004, 06:34:49 AM »

You can, but it involves some calculations and opening the file as binary. Why don't you just create a binary file with direct access?
Logged

SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #2 on: April 16, 2004, 09:44:12 PM »

... and if that's too complicated, what's wrong with re-writing the whole file with one number change anyway? (depending if it's a small file, of course...)
Logged

andy
Senior Member
**
Posts: 175



WWW
« Reply #3 on: April 20, 2004, 09:40:34 AM »

the idea was so that I didn't keep it in an array but held the numbers in the file
Logged

eminiscing about trapezoids in conjunction with stratospherical parabolas:

No questions asked.

www.stickskate.com
oracle
*/-\*
*****
Posts: 3652



WWW
« Reply #4 on: April 20, 2004, 07:01:57 PM »

Then you're best using what nath said Wink

Look up the QB help for GET, PUT and BINARY file mode.
Logged

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!