c - capturing empty output returned from commandline and display some message if its empty -
The script " check.sh " allows me to print something in my window when there is no return It means verification, when no output is returned from the script.
Check.sh is nothing in it, it's just an empty file that does not return anything when executed. I'm testing with an empty sh file (why can not I show that exact script).
Whatever I want to print is some message like "Configure something" via C.
I checked the buffer line (check in the module below) "\ n", "\ r", "\ 0", NULL .. I do not know
I am calling the module as execute_command ("sh check.sh")
This is mine Module
char * execute_command (char * command) {FILE * fpipe; Four lines [1024] = ""; // four * line = (four *) maulok (1024 * size (four)); Int i = 0; If (fpipe = (FILE *) popen (command, "r")) {// If the pipip is the tap membrane ("problem with pipe"); exit (1);} while (fgets (line, Size line, fpipe) {// printf ("% s", line);} while (line [i]! = '\ 0') {if (line [i] == '') {line [i ] = ',';} I ++;} Pclose (fpipe); printf ("% s", line); // This is where I want to know what's in the buffer when the script returns (line) back Do not give;}
Before any character is read, it is a
NULL returns
Land and buffer the content remains unchanged.
Comments
Post a Comment