.txt to C++ commands.

First of all, i'm an Extreme beginner in C++ (learning from a book), and Engish is not my language.
So...I'd like to create an .exe file (using C++), which reads commands from a .txt file , what can i edit every time.
Example: I'd like to run some another applications named in the txt file.
This already exists - for example look up the term "batch script". Batch script programming will give you headaches though, be warned.

Unless what you want to do is more like a scripting language? Your request is vague.
Last edited on
Yeah, well i heard about batches.
So actually what i want is to create an EXE file with c++ , what opens a file, what i determine in a txt file and i can change it every time i want.
Last edited on
That's still extremely vague.
Can you give an example of such a text file and what you'd want the text file to do?

It really does sound like you want to write batch/scripts rather than an actual program. C++ might not be the right tool for this job. But as L B is saying it's really hard to say because it's not exactly clear what you're looking for.
i'd like that the script (or c++.exe) opens another programs, which are named in the textfile. Sorry for my awesome English.
Last edited on
so... yeah.... then in a batch file you just do this:


Save that as "whatever.bat" instead of "whatever.txt". When you run it, it will launch whatever program you want. C++ is not the right tool here.
Last edited on
This is what batch programs are - a list of programs with arguments. cmd.exe will open the script file and run each program listed in order.
I understand that but i made a script (.vbs) and that script can only edit .txt files. I'd like that a program to run the another program what .vbs writed in the txt.
Last edited on
RonnieNine wrote:
I'd like that a program to run the another program what .vbs writed in the txt.
I don't understand, can you clarify?

Have you looked into batch scripts? (.bat)
batch files are text files. Just with a different extension.

Change your VBS script to modify .bat instead of .txt and your problem is solved.
Okay..i will look forward to it. Thank you! If i find it out how to modify .bat with vbs i will post it!
Yeah Disch thats right, however i can't find something like that. Only .txt editor.
the code is this:
 Const ForReading = 1, ForWriting = 2, ForAppending = 8, CreateIfNeeded = true
set fso = CreateObject("Scripting.FileSystemObject")
set file = fso.OpenTextFile("output.txt", ForWriting, CreateIfNeeded)

if i change "output.txt" to "output.bat" iwót will not work?
Last edited on
IT WORKS! Thank you!
Topic archived. No new replies allowed.