Using ShellExecuteEx and capturing standard in/out/err
I'm using ShellExecuteEx to execute a command in C. Is there a way to use ShellExecuteEx and capture standard in/out/err? Note: I don't want to use CreateProcess. ...
I'm using ShellExecuteEx to execute a command in C. Is there a way to use ShellExecuteEx and capture standard in/out/err? Note: I don't want to use CreateProcess. ...
It seems that every project has an "utility" module with various code snippets used throughout other files and which don't fit any particular pattern. What utility classes, functions, and macros do you find most useful in your C/C++ projects? Please keep the entries small (under 100 lines) and give only one example per post. ...
My application runs on a pSOS operating system. The code is compiled with Diab C compiler. The application defines a number of counters which have been declared as unsigned int call_count; As there are chances of some of these overflowing in a small time frame, I have decided to declare the counters as unsigned long long int call...
Is there a way to portably determine the upper and lower bound on void-pointer values in ANSI C89/ISO C90? (I currently do not have a copy of the standard with me (I have one at home). Of course if void-pointer values are guaranteed to be unsigned this task is trivial (via sizeof(void *)); however, I cannot recall if this is guaranteed ...
I searched in linux box and saw it being typedef to typedef __time_t time_t; But could not find the __time_t definition. ...
Win32's CreateFile has FILE_FLAG_DELETE_ON_CLOSE, but I'm on Linux. I want to open a temporary file which will always be deleted upon program termination. I could understand that in the case of a program crash it may not be practical to guarantee this, but in any other case I'd like it to work. I know about RAII. I know about signals...
I am a little confused by the following C code snippets: printf("Peter string is %d bytes\n", sizeof("Peter")); // Peter string is 6 bytes This tells me that when C compiles a string in double quotes, it will automatically add an extra byte for the null terminator. printf("Hello '%s'\n", "Peter"); The printf function knows when to ...
For example I want to do some thing when some combination of Ctrl key with any other key is pressed (or it may be Alt key).Then from the standard input how to read that key combination in C program as an input. I tried with simple getchar() to know the ascii values of these combinations. But it was some 1 to 25 and some other values for...
What data types are usually used in C API implementation for storing byte streams? How can I convert this type to jbyteArray? ...
I'm looking for the fastest way of counting the number of bit transitions in an unsigned int. If the int contains: 0b00000000000000000000000000001010 The number of transitions are: 4 If the int contains: 0b00000000000000000000000000001001 The number of transitions are: 3 Language is C ...
If I declare a variable const char ** stringTable, how should I be able to put values to it if it is a const? (It has to be const because a function I am supposed to use takes const char ** as a parameter.) Edit: No you cannot convert from char ** to const char ** implicitly. Compiler complains: cannot convert parameter 3 from 'char **'...
Hello, Is it a good idea to use GetGuiResources(GetCurrentProcess(),GR_GDIOBJECTS) at the start of winmain, and before the last return to detect GDI leaks or more specifically objects I forgot to release ?Also I'm currently wondering why the first call in my progam returns 4 when there's no window yet. ...
The question I meant to ask concerned the mantissa, not the exponent, and has lots to do with the question I asked earlier in the week regarding "missing" digits on the sum of two negative floats. Given that the mantissa has a variable precision, how does one tell if one has overflowed the mantissa's current precision setting? Or, from ...
Is there a POSIX function that will give me the size of a directory (including all sub-folders), roughly equivalent to "du -s somepath"? ...
Hi, I have a scenario where i need to generate all possible keystrokes using numbers 2 to 9. The possible keystrokes should generate 2-git, 3-digit etc upto 32-digit numbers. can anybody tell me what is the best way to solve this problem. Thanks, Pdit ...
I'm embedding javascript in my app using spidermonkey and I have a function called reportError that receives a JSErrorReport. It seems simple to grab the current line of the error, but is it possible to get the entire call path to display a full backtrace? ...
Is there an equivalent event to LBN_SELCHANGE but for a listview? ...
#include <stdio.h> #include <conio.h> main() { char ch,name[20]; int i=0; clrscr(); printf("Enter a string:"); while((ch=getch())!='\n') { name[i]=ch; i++; } name[i] = '\0'; printf("%s",name); } when I give abc as input and if I press enter its not working. Can anyone let me know why the condit...
Okay, so I read the k&r and C in 21 days (never quite finished the k&r) I never really liked looking through books, reading line after line to learn what n++ does. I want to write some nice interesting stuff, and I don't want to have to spend hours on end reading books that talk about basic programming functions. Even though I never did...
In another question, the accepted answer shows a method for reading the contents of a file into memory. I have been trying to use this method to read in the content of a text file and then copy it to a new file. When I write the contents of the buffer to the new file, however, there is always some extra garbage at the end of the file. ...