How do i create a file, open it to writ to, and then run it. (like a batch file etc.) I looked at the tutorial, but i still dont understand the syntax.
Randomly bumping your post every few minutes will not help you any. If you show a little more patient and give a little more insight to what you mean, you'll get more help.
With that said, what are you talking about? Do you want to write a program that will write to a batch file and then run the batch file?
2- well, yes. I wrote this exact program useing BASIC language and i want to excercise my C++ my replicating it. With that said, i have the input/output form the user, i just need to correctly write the code to open/create the file, write to it, close the file, then execute the file, and lastly delete the file so that we dont (after say, 10 uses) have a bucket load of batch files sitting around. Only thing is, im not quite sure i understand the syntax of the "open/close" statements or how to use them. Mabey an example and an explanation would help me out. Thank you for your time!
what? yes it has, dude, it's been 5 entire days. I've been re-posting the last post to bump it up (after being completely knocked off the page) in hopes of my questiong being answered by someone.
what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you. what is the statement that specifies and runs a file? What is the statement that deletes a file? I would apprecciate this, thank you.
#include <iostream>
#include <fstream>
usingnamespace std;
int main(){
char filename[MAX_PATH + 1];
char input_line[MAX_PATH + 1];
cout << "Input a file path and name and press ENTER: ";
cin.getline(filename, MAX_PATH);
ifstream myfile(filename);
if(!myfile){
system("PAUSE");
return -1;
}
myfile.getline(input_line, MAX_PATH);
cout << input_line << endl;
myfile.close();
system("PAUSE");
return 0;
}
?? Sorry i am confused because of this " I got it to create the files, not i just need it to run them and delete them." ?! Okay i think it is this 0.o.
ok... what's the "run" statement in that? I can't just write jibberish i don't understand... Explain to me how this works please. Sorry if i come up a bit obnoxious, i just cant find an answer to this question. Thank you for your time.
when a program is active, we say it is "running", yes?
How do i make my program "run" a batch file??? I'm not quite sure how you can make a virus with C++, but you can't MERELY run a simple batch file...
The BASIC language allows you to run a file, so why not C++??????????????!?!