Click here to Skip to main content
15,561,125 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: c++ code interpreter/debugging tool Pin
Greg Utas11-Nov-21 3:06
mveGreg Utas11-Nov-21 3:06 
GeneralRe: c++ code interpreter/debugging tool Pin
Calin Negru11-Nov-21 3:58
Calin Negru11-Nov-21 3:58 
GeneralRe: c++ code interpreter/debugging tool Pin
Greg Utas11-Nov-21 4:15
mveGreg Utas11-Nov-21 4:15 
GeneralRe: c++ code interpreter/debugging tool Pin
Calin Negru11-Nov-21 7:49
Calin Negru11-Nov-21 7:49 
AnswerRe: c++ code interpreter/debugging tool Pin
Randor 13-Nov-21 4:54
professional Randor 13-Nov-21 4:54 
GeneralRe: c++ code interpreter/debugging tool Pin
Calin Negru13-Nov-21 7:01
Calin Negru13-Nov-21 7:01 
QuestionWhere to find resource on "how to analyze " system call output Pin
Member 1496877122-Oct-21 8:10
Member 1496877122-Oct-21 8:10 
AnswerRe: Where to find resource on "how to analyze " system call output Pin
k505422-Oct-21 9:31
mvek505422-Oct-21 9: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 22:05
rdeekonda20-Oct-21 22:05 
AnswerRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Richard MacCutchan20-Oct-21 23:21
mveRichard MacCutchan20-Oct-21 23:21 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda21-Oct-21 22:47
rdeekonda21-Oct-21 22:47 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Victor Nijegorodov21-Oct-21 23:55
Victor Nijegorodov21-Oct-21 23:55 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda22-Oct-21 7:10
rdeekonda22-Oct-21 7:10 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Victor Nijegorodov22-Oct-21 7:55
Victor Nijegorodov22-Oct-21 7:55 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda24-Oct-21 7:12
rdeekonda24-Oct-21 7:12 
GeneralRe: Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda25-Oct-21 3:31
rdeekonda25-Oct-21 3:31 
Rant[REPOST] Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Richard Deeming21-Oct-21 0:31
mveRichard Deeming21-Oct-21 0:31 
GeneralRe: [REPOST] Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
rdeekonda21-Oct-21 22:59
rdeekonda21-Oct-21 22:59 
GeneralRe: [REPOST] Changing the icons displayed on an outlook bar style property sheet (class CMFCPropertySheet) Pin
Richard MacCutchan22-Oct-21 0:57
mveRichard MacCutchan22-Oct-21 0:57 
QuestionCBitmap::LoadBitmap help Pin
ForNow18-Oct-21 16:55
ForNow18-Oct-21 16:55 
AnswerRe: CBitmap::LoadBitmap help Pin
Victor Nijegorodov18-Oct-21 21:33
Victor Nijegorodov18-Oct-21 21:33 
GeneralRe: CBitmap::LoadBitmap help Pin
ForNow19-Oct-21 2:59
ForNow19-Oct-21 2:59 
GeneralRe: CBitmap::LoadBitmap help Pin
Victor Nijegorodov19-Oct-21 3:50
Victor Nijegorodov19-Oct-21 3:50 
GeneralRe: CBitmap::LoadBitmap help Pin
ForNow19-Oct-21 4:22
ForNow19-Oct-21 4:22 
GeneralRe: CBitmap::LoadBitmap help Pin
Victor Nijegorodov19-Oct-21 6:20
Victor Nijegorodov19-Oct-21 6: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.