Hello,
I am working on a project where I can to convert a api digit to a char. I have used an array of string pointers to get the conversion. However, I want to return just a single ch, as my api that I am using will only accept a char. So ap_five will return "5". But I want to five to be a single char '5'.
I thought maybe I could cast...
I have a dictionary that goes like this:
typedef struct dictNode {
int key;
char *value;
struct dictNode *next;
} Dict;
And a get() function that goes like this:
char *get(const Dict *dict, int key) {
if(!dict) return NULL;
Dict *currPtr = dict;
while(currPtr) {
if(currPtr->key == key) {
return cu...
I want to use NetBeans to build the GUI for my project, but implement the functionality using C code. Is there any way I can make the C code run when a button in the GUI is clicked?
...
Hi!
A great feature - I think - is, when languages, running in a virtualized way like C# and Java show errors during you're working on the source. Most often IDEs like Eclipse or NetBeans or VisualStudio have the feature to specify errors immediately.
Is there anything like this for C/C++? Just for coding... I'm currently searching for...
Duplicate of http://stackoverflow.com/questions/193896/whats-a-good-c-decompiler and http://stackoverflow.com/questions/205059/is-there-a-c-decompiler taken together.
Does somebody know any opensource C/C++ decompiler? I don't want to use any commercial solution like IDA Pro.
...
I need to simulated a Linux command line utility "cal -3" where it will displays three calendar side by side. What I need right now is to get my pipe working. I've been told that I can't use fork(), rather using dup2() and write(), read(), close() to call system("myCustomCommand") tree times. Right now my program does not display calenda...
Is there an API call on Linux which returns currently opened TCP connections on the system (like GetTcpTable call on Windows)?
Thanks.
...
In C, is there a nice way to track the number of elements in an enum? I've seen
enum blah {
FIRST,
SECOND,
THIRD,
LAST
};
But this only works if the items are sequential and start at zero.
...
I have two separate processes: a C program that outputs comma separated values followed by a newline every second, and a Perl program that accepts data (in the same format) and processes this data.
The C program outputs (via printf) values as such:
1, 2, 3, 4, 5, 6
7, 8, 9, 10, 11, 12
...
The Perl program sits in an infinite lo...
In a simple list, ex :
struct Node {
Node *next;
void *data;
}
is there any problem if i allocate Node and Data in a single allocation (provided i know the size), like
Node * t = (Node*)malloc(sizeof(Node) + DataSize));
and always assign data at the end of allocated chunk,
t->data = (BYTE*)t+ sizeof(Node); /* BYTE...
I got a comment to an answer I posted on a C question, where the commenter suggested the code should be written to compile with a C++ compiler, since the original question mentioned the code should be "portable".
Is this a common interpretation of "portable C"? As I said in a further comment to that answer, it's totally surprising to me...
In ANSI C, offsetof is defined as below.
#define offsetof(st, m) \
((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))
Why won't this throw a segmentation fault since we are dereferencing a NULL pointer? Or is this some sort of compiler hack where it sees that only address of the offset is taken out, so it statically calculates the...
Every time Microsoft releases a new version of visual studio, they always require me to convert my solution and project files to 'the latest version.' Even with something as simple as a "Hello World" solution, I need to go through their conversion wizard!
And, to make things worse, the new visual studio solution files aren't compatible...
How does one implement alloca() using inline x86 assembler in languages like D, C, and C++? I want to create a slightly modified version of it, but first I need to know how the standard version is implemented. Reading the disassembly from compilers doesn't help because they perform so many optimizations, and I just want the canonical f...
At the risk of oversimplifying something I'm worried might be ridiculously complex, what should I be aware of when mixing C and Objective-C?
Edit: Just to clarify, I've never worked with C before, and I'm learning Objective-C through Cocoa. Also I'm using the Chipmunk Dynamics engine, which is C.
...
There's a joke in there somewhere.
Anyhoot. In the following code, the setForceVector method has no actual effect on the value of member it's attempting to change. By checking the log, I can see the function is being called (by another object handling to a touchEvent).
I've used NSLog to check that the forceVectorfromControls is actu...
Assume library A has a() and b(). If I link my program B with A and call a(), does b() get included in the binary? Does the compiler see if any function in the program call b() (perhaps a() calls b() or another lib calls b())? If so, how does the compiler get this information? If not, isn't this a big waste of final compile size if I'm l...
I have some c headers, and a c lib that I'd like to import and use in a c# project. How can I do this?
...
How to print the bit representation of a string
std::string = "\x80";
void print (std::string &s) {
//How to implement this
}
...
Here's the situation. I've got a two different window hooks, one's a global hook of the WH_SHELL variety that watches for new top-level windows, the second's a thread hook of the WH_CALLWNDPROC which is set on some of the top-level windows discovered by the first hook. The two hooks are implemented in different DLLs.
As far as I can t...