Click here to Skip to main content
15,867,308 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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

QuestionChanging the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda20-Oct-21 21:05
rdeekonda20-Oct-21 21:05 
AnswerRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Richard MacCutchan20-Oct-21 22:21
mveRichard MacCutchan20-Oct-21 22:21 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda21-Oct-21 21:47
rdeekonda21-Oct-21 21:47 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Victor Nijegorodov21-Oct-21 22:55
Victor Nijegorodov21-Oct-21 22:55 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda22-Oct-21 6:10
rdeekonda22-Oct-21 6:10 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Victor Nijegorodov22-Oct-21 6:55
Victor Nijegorodov22-Oct-21 6:55 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda24-Oct-21 6:12
rdeekonda24-Oct-21 6:12 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda25-Oct-21 2:31
rdeekonda25-Oct-21 2:31 
Rant[REPOST] Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Richard Deeming20-Oct-21 23:31
mveRichard Deeming20-Oct-21 23:31 
GeneralRe: [REPOST] Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda21-Oct-21 21:59
rdeekonda21-Oct-21 21:59 
GeneralRe: [REPOST] Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Richard MacCutchan21-Oct-21 23:57
mveRichard MacCutchan21-Oct-21 23:57 
QuestionCBitmap::LoadBitmap help Pin
ForNow18-Oct-21 15:55
ForNow18-Oct-21 15:55 
AnswerRe: CBitmap::LoadBitmap help Pin
Victor Nijegorodov18-Oct-21 20:33
Victor Nijegorodov18-Oct-21 20:33 
GeneralRe: CBitmap::LoadBitmap help Pin
ForNow19-Oct-21 1:59
ForNow19-Oct-21 1:59 
GeneralRe: CBitmap::LoadBitmap help Pin
Victor Nijegorodov19-Oct-21 2:50
Victor Nijegorodov19-Oct-21 2:50 
GeneralRe: CBitmap::LoadBitmap help Pin
ForNow19-Oct-21 3:22
ForNow19-Oct-21 3:22 
GeneralRe: CBitmap::LoadBitmap help Pin
Victor Nijegorodov19-Oct-21 5:20
Victor Nijegorodov19-Oct-21 5:20 

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.