Before I show the code let me explain what I'm trying to do and that I've been at it for the last 2 1/2 hours and it is seriously starting to get under my skin lol.
I have a dos program that will load files through it. It's kind of like a viewing program. This program isn't much use without the supported file types. If this program encounters an error while loading a file through itself, it hault loading it and display a message, then go back to the dos prompt.
What I'm trying to do is surpress EVERYTHING that this program spits out onto the dos / dos box screen. This I can do fine lol. I will load a file through that program, with the program I'm creating now. While this external program is busy loading the file through itself I am surpressing everything it disaplays ( >NUL ) until it finally does it's thing. While the external program is loading a file through it and an error occurs however, I want to display my own message (easy) since I surpressed the standard one that the external program will be putting out (which is what I want). So, my program will do the work for you. It will activate this external dos program (command line) and tell it to load whatever file through it. If it runs into an error it displays a message. If it does not error, it does nothing(cause the external program loaded that file with no problem).
Code:int main() { if ((system("pgm >NUL") == 0)) { printf("there was an error."); } else { printf("there wasn't an error"); } return 0; }