Click here to Skip to main content
15,916,463 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: ++ operator in the case of pointers Pin
Richard MacCutchan15-Nov-21 6:20
mveRichard MacCutchan15-Nov-21 6:20 
GeneralRe: ++ operator in the case of pointers Pin
Calin Negru15-Nov-21 7:10
Calin Negru15-Nov-21 7:10 
GeneralRe: ++ operator in the case of pointers Pin
Richard Andrew x6415-Nov-21 7:26
professionalRichard Andrew x6415-Nov-21 7:26 
GeneralRe: ++ operator in the case of pointers Pin
Calin Negru15-Nov-21 7:38
Calin Negru15-Nov-21 7:38 
AnswerRe: ++ operator in the case of pointers Pin
k505415-Nov-21 11:37
mvek505415-Nov-21 11:37 
GeneralRe: ++ operator in the case of pointers Pin
Calin Negru16-Nov-21 2:55
Calin Negru16-Nov-21 2:55 
GeneralRe: ++ operator in the case of pointers Pin
Richard MacCutchan17-Nov-21 3:02
mveRichard MacCutchan17-Nov-21 3:02 
GeneralRe: ++ operator in the case of pointers Pin
Calin Negru17-Nov-21 6:10
Calin Negru17-Nov-21 6:10 
GeneralRe: ++ operator in the case of pointers Pin
jsc4217-Nov-21 4:58
professionaljsc4217-Nov-21 4:58 
GeneralRe: ++ operator in the case of pointers Pin
k505417-Nov-21 5:20
mvek505417-Nov-21 5:20 
Questionc++ code interpreter/debugging tool Pin
Calin Negru10-Nov-21 1:40
Calin Negru10-Nov-21 1:40 
AnswerRe: c++ code interpreter/debugging tool Pin
jeron110-Nov-21 6:09
jeron110-Nov-21 6:09 
GeneralRe: c++ code interpreter/debugging tool Pin
Calin Negru10-Nov-21 7:36
Calin Negru10-Nov-21 7:36 
GeneralRe: c++ code interpreter/debugging tool Pin
jeron110-Nov-21 7:47
jeron110-Nov-21 7:47 
General[edit] Re: c++ code interpreter/debugging tool Pin
Calin Negru10-Nov-21 8:25
Calin Negru10-Nov-21 8:25 
AnswerRe: c++ code interpreter/debugging tool Pin
k505410-Nov-21 8:23
mvek505410-Nov-21 8:23 
GeneralRe: c++ code interpreter/debugging tool Pin
Calin Negru10-Nov-21 19:40
Calin Negru10-Nov-21 19:40 
GeneralRe: c++ code interpreter/debugging tool Pin
Greg Utas11-Nov-21 2:06
professionalGreg Utas11-Nov-21 2:06 
GeneralRe: c++ code interpreter/debugging tool Pin
Calin Negru11-Nov-21 2:58
Calin Negru11-Nov-21 2:58 
GeneralRe: c++ code interpreter/debugging tool Pin
Greg Utas11-Nov-21 3:15
professionalGreg Utas11-Nov-21 3:15 
GeneralRe: c++ code interpreter/debugging tool Pin
Calin Negru11-Nov-21 6:49
Calin Negru11-Nov-21 6:49 
AnswerRe: c++ code interpreter/debugging tool Pin
Randor 13-Nov-21 3:54
professional Randor 13-Nov-21 3:54 
GeneralRe: c++ code interpreter/debugging tool Pin
Calin Negru13-Nov-21 6:01
Calin Negru13-Nov-21 6:01 
QuestionMessage Closed Pin
22-Oct-21 7:10
Member 1496877122-Oct-21 7:10 
AnswerRe: Where to find resource on "how to analyze " system call output Pin
k505422-Oct-21 8:31
mvek505422-Oct-21 8:31 
Rather than system(), you want to use popen(). The only problem is that popen() doesn't supply a separate FILE for stderr, so you have to use output redirection to capture both e.g.
C
FILE *cmd = popen("hcitool dev 2>&1", "r");

char *buffer = NULL;
size_t len = 0;
ssize_t readlen;
while ( (readlen = getline(&buffer, len, cmd)) > 0)
{
   /* process input buffer */
}
free(buffer);
pclose(cmd);
You could perhaps also use output redirection to capture output separately e.g.
C
FILE *cmd = popen("hcitool dev 2>/tmp/hcierrs", "r");
   /* process input as above */
FILE *cmd_errs = fopen("/tmp/hcierrs", "r");
   /* loop through input from cmd_errs ... */
unlink("/tmp/hcierrs");
If you're going to do that, you might want to look at creating unique temporary file names, so that you don't clobber output if you happen to have more than one instance of the program running at the same time. mkstemp() can help you here.
For the really advanced, you might look into trying "roll your own" version of popen that uses fork() and one of the exec() functions to separate out stdout and stderr to two separate FILES.
Keep Calm and Carry On

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.