identify.exe output to file?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

I think that system() just passes all its arguments to identify without interpreting ">out.txt" as redirection. You have to do the redirection yourself.
I don't know how you would do this in C++ but in C I did this with the freopen function:

Code: Select all

freopen("out.txt","w",stdout);
and then call "identify".

Pete
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

Try adding "fclose(stdout);" after your system call.

Pete
el_supremo
Posts: 1015
Joined: 2005-03-21T21:16:57-07:00

Post by el_supremo »

I was closing the file pointer returned by freopen

That's the correct thing to do. My brain obviously wasn't in gear when I wrote fclose(stdout)!. Sorry.

Pete
Post Reply