0

here goes the problem:

suppose if I want to run a plot.exe in cmd, I wrote the following line in cmd,

plot image.jpg

BTW I was trying in this way in my c file:

system("start plot image.jpg")

the above command start the cmd and also the plot command but the image file did not popup. There is an error command:

"image.jpg is not def"

What does it meant by? please help me out.

2
  • 3
    The arguments to the system() function should be exactly as you would type them on the command line. Try calling it without "start" Commented Mar 4, 2012 at 4:58
  • still the same error msg came out dude Commented Mar 4, 2012 at 5:08

1 Answer 1

6

Probably the process's working directory is not the directory that contains the image. You can either specify the full path to the image:

system("plot /full/path/to/image.jpg");

or use chdir to change the working directory before running the command:

if(chdir("/full/path/to/") == -1)
    ; // TODO handle error
system("plot image.jpg");
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.