i made a program that launches a file in the main method...something like:
int main()
{
ShellExecute(hwnd, "open", "list.bat" , NULL,0, SW_MAXIMIZE); //create a text file of the song list;
...
}
this runs a batch file which creates a text file.
now, i want the program to access that text file created by this batch file while the program is still running. at the moment, what happens is that i have to run the program twice...1st to create the file, 2nd to access the file. what do i have to do in order to get this done in one process only??
someone suggested closing the text file created by the batch file. however, how am i supposed to do that since i haven't even assigned a variable name to the file until i use ifstream to open the file. maybe i have to close it through the batch file itself?
Question
Arpit
here's the idea...
i made a program that launches a file in the main method...something like:
int main()
{
ShellExecute(hwnd, "open", "list.bat" , NULL,0, SW_MAXIMIZE); //create a text file of the song list;
...
}
this runs a batch file which creates a text file.
now, i want the program to access that text file created by this batch file while the program is still running. at the moment, what happens is that i have to run the program twice...1st to create the file, 2nd to access the file. what do i have to do in order to get this done in one process only??
someone suggested closing the text file created by the batch file. however, how am i supposed to do that since i haven't even assigned a variable name to the file until i use ifstream to open the file. maybe i have to close it through the batch file itself?
Please help...thanks.
Link to comment
Share on other sites
2 answers to this question
Recommended Posts