0

How to run a Cpp from windows terminal?

i was working in a small project. where i have to work with file.bmp. now i have invert the image and save it. after that user can run the cpp file in terminal and can see the result with comand line argumeng. so can you please tell me how can i run my cpp on terminal and how to pass a argument so that user can just see the image from the folder with that argument.

10th Dec 2016, 9:05 PM
Kazi Ataul Goni
Kazi Ataul Goni - avatar
8 ответов
+ 1
Create a new textfile in the folder of your executable called start.bat Write following in this file @echo off [yourProgName].exe input.bmp output.bmp mspaint output.bmp
10th Dec 2016, 9:51 PM
feye
0
Create a so called batch file. The file ending is .bat or .cmd Another way is to create a link to this file and pass the argument in the options dialog of that linkfile
10th Dec 2016, 9:32 PM
feye
0
i already passed the argument. like inputImage.bmp resultImage.bml . so while user will run my cpp from the termin it will take the inputImage.bmp and invert it and then save it as resultImage.bmp. so my intention is how a user can see the image from termin after compiling the cpp file
10th Dec 2016, 9:38 PM
Kazi Ataul Goni
Kazi Ataul Goni - avatar
0
You can not show bmp in terminal in the way you would like it. But if you create the script you could call an image viewer and pass the path of your output file to it.
10th Dec 2016, 9:40 PM
feye
0
but whenever someone compile the cpp terminal already know the path. so after that if user input the resultImage.bmp it should pop up right?
10th Dec 2016, 9:43 PM
Kazi Ataul Goni
Kazi Ataul Goni - avatar
0
Then pass the name of that file to the image viewer. Yep it will just pop up.
10th Dec 2016, 9:45 PM
feye
0
can you please tell me how to compile a cpp file from .cmd? could do do this even i showed the termind using cd , dir comand
10th Dec 2016, 9:47 PM
Kazi Ataul Goni
Kazi Ataul Goni - avatar
0
Or you could get the directory of the file, so for example lets say the file is called test.cpp and is in Desktop we would do ``` cd Desktop/ g++ hello.cpp ./a.out #We do ./a.out as we are calling the file created called a.out and running it ```
21st Aug 2019, 8:39 PM
Sticks Studios
Sticks Studios - avatar