I have writtten a program and it is compiled smoothly. However when I try to run the program, the console just comes out a while and then closes. I don't even have chance to type in commands and the commands will be recorded by **argv.

int main(int argc, char **argv)
{
         .............
         .............
}

May I know what should I do?

Recommended Answers

All 4 Replies

If, you are using Visual c++, then goto Project-> settings and then to the debug tab. There in the arguments, text box type your commandline arguments, If not visual c++, then search for argument text box. There will be one some where.

or if you are running in console
<pgm-name> arg1 arg2
will work.

You may show us the meaning of
.............
.............

If, you are using Visual c++, then goto Project-> settings and then to the debug tab. There in the arguments, text box type your commandline arguments, If not visual c++, then search for argument text box. There will be one some where.

or if you are running in console
<pgm-name> arg1 arg2
will work.

I believe you are right, but I just do not know how to set it up. Below is the requirement of my program.

"The program runs on the command line. It reads an image from a file (the first program argument) and writes an image to a file (the second program argument). In between, it processes the image using the filters specified by subsequent command line arguments. For example, to increase the brightness of the image in.bmp by 10%, and save the result in the image out.bmp, you would type:
% imgpro in.bmp out.bmp -brightness 1.1
For each available image filter there may be one or more optional parameters (e.g., brightness takes a factor). To see the complete list of filters and their parameters, type:
% imgpro -help
If you specify more than one filter on the command line, they are applied in the order that they are found. For example,
% imgpro in.bmp out.bmp -contrast 0.8 -scale 0.5 0.5
would first decrease the contrast of the input image by 20%, and then scale down the result by 50% in both x and y directions. "

May I know how to set it up so that I can type the command in the console? Thanks

Hi, I have solved the problem. I know how to set the setting. Thanks for your help.

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.