Qbasicnews.com
May 26, 2019, 10:15:49 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: ..Changing lines in files..  (Read 1782 times)
Yarik
New Member

Posts: 5


« on: July 18, 2003, 05:31:21 PM »

I have an exe.  And I want my program to do 2 things.
#1 Open the exe and edit 2 words from "Mainta" to "Maintx"
#2 Open the exe and edit 2 words from "Maintx" back to "Mainta"
I dont know how to do this.  Is there a tutorial that will let me
search for a specific sequence of numbers and or letters and replace them?
If somone can please show me how to do this.
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #1 on: July 18, 2003, 05:57:14 PM »

You need to use GET and PUT to look at the whole file as sort of one large string, OR (if it's a TEXT file), use LINE INPUT #1:

http://forum.qbasicnews.com/viewtopic.php?t=3389&

Don't forget the different OPEN modes..(bINARY, OUTPUT, INPUT..)

To search for something:

a$ = "'Welcome to McDonald's!' 'Yes, um.. I'd like a Happy Meal.' 'Do you want fries with that?'"

searchfor$ = "fries"

PRINT INSTR(a$, searchfor$) 'built-in function. Smiley
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Yarik
New Member

Posts: 5


« Reply #2 on: July 18, 2003, 07:04:53 PM »

Quote
a$ = "'Welcome to McDonald's!' 'Yes, um.. I'd like a Happy Meal.' 'Do you want fries with that?'"

searchfor$ = "fries"

PRINT INSTR(a$, searchfor$) 'built-in function.

I kinda dont understand you.
Can you explain what is A$ = "..." for ?
What what is searchfor$ = "fires" for.
Logged
Agamemnus
x/ \z
*****
Posts: 3491



« Reply #3 on: July 19, 2003, 01:14:15 PM »

Run it.

"I dont know how to do this. Is there a tutorial that will let me
search for a specific sequence of numbers and or letters and replace them?
If somone can please show me how to do this"

searchfor$ is what you search for, and a$ is what is searched.
Logged

Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
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!