Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
..Changing lines in files..
#1
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.
Reply
#2
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. Smile
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.
Reply
#3
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.
Reply
#4
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.
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)