custom cmd line program in c++

Hi
I am using zbar for barcode scanning. and I want to execute a commaand in command prompt provided by z bar in a c++ console application
I need guidance I am beginner in C++
The easiest way to execute a program is with the system() call. For example:
system("dir");
or
system("C:\\zbar\\bin\\someprogram.exe arg1 arg2 arg2");

Why the "\\" instead of "\"? C++ uses "\" to let you specify special characters like tab "\t" or a newline "\n". To specify backslash itself, you must use two: "\\".
Last edited on
windows and dos both support pipes and files too.
so
system("program > filename"); //dump the output of program to filename
and program < infile //infile interacts with program as if you types its contents when program was executed, eg menu option 3, value x, value y, .. etc)
and pipes let you do similar without the files.

you can also write a batch file that does the work and run the batch file from the C++.

its very flexible.
Registered users can post here. Sign in or register to post.