..Changing lines in files.. - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: QBasic (http://qbasicnews.com/newforum/forum-4.html) +--- Forum: QB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-11.html) +--- Thread: ..Changing lines in files.. (/thread-1539.html) |
..Changing lines in files.. - Yarik - 07-19-2003 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. ..Changing lines in files.. - Agamemnus - 07-19-2003 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. ..Changing lines in files.. - Yarik - 07-19-2003 Quote:a$ = "'Welcome to McDonald's!' 'Yes, um.. I'd like a Happy Meal.' 'Do you want fries with that?'"I kinda dont understand you. Can you explain what is A$ = "..." for ? What what is searchfor$ = "fires" for. ..Changing lines in files.. - Agamemnus - 07-19-2003 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. |