Hello,
I am trying to incorporate the use of a batch file towards my program. For this I just want that after the program has starting running to send the file content's to stdin, in which case the program should do the rest? Is this possible, how so? Or should I be doing something completely different. Thanks.
flipjoebanana 0 Junior Poster in Training
Recommended Answers
Jump to PostI think you might be confused about the purpose of a batch file. Batch files are interpreted by the operating system -- not a program that you write. Yes, you can write a program that reads a batch file, but what will it do with it???
Jump to PostStep 1: create the text file that contains the commands
Step 2 write the c++ program using std::cin as you normally would. Here's an example
#include <iostream> #include <string> using namespace std; int main(int argc, char* argv[]) { string line; while( cin >> line ) cout …
Jump to PostHe means if argc > 1 then you can assume argv[1] is the filename. But if argc == 0 or 1 then you can assume the filename was not entered on the command line like your example
int main(int argc, char* argv[]) { FILE* file = 0; …
Jump to Post>>I'm also not clear as to the naming of an input file as a 'batch' file. Is that name specific to input files for OS command line interfaces only?
No. The way you want to use them they are not batch files at all but just normal every-day text …
Jump to Postalmost done with the batch file question. If I make a command line interface to a software program where a file contains commands for that program to execute, would you call that file a batch file?
For the millionth time: batch files are interpreted by the operating system. If the …
All 19 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
flipjoebanana 0 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
flipjoebanana 0 Junior Poster in Training
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
flipjoebanana 0 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
flipjoebanana 0 Junior Poster in Training
WaltP 2,905 Posting Sage w/ dash of thyme Team Colleague
flipjoebanana 0 Junior Poster in Training
stilllearning 148 Posting Whiz
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
flipjoebanana 0 Junior Poster in Training
stilllearning 148 Posting Whiz
flipjoebanana 0 Junior Poster in Training
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
stilllearning 148 Posting Whiz
flipjoebanana 0 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.