c

Long long int on 32 bit machines

Hi,very simple question, I read that GCC supports long long int type. But how can make math operations with it, when CPU is 32 bit wide only? ...

Object Oriented ANSI C?

Possible Duplicate: Can you write object oriented code in C? Hello, I'm wondering if it's possible to use strict ANSI C as a object oriented language. And if it's possible, how do I make a class in ANSI C. Allthough the language isn't designed for OO, I'm really eager to try this. Any examples, links etc. are appreciated. T...

Does it feel anytime that c++ sometimes reduces problem solving time and increases syntactic, semantic rigor ??

C++ introduces OOPS, templates and variety of other concepts. But sometimes I am stuck in unmanageable storm of calling convention incompatibilities between methods, convoluted casting between distantly connected classes and struggling with code that forces me think in the level of byte-alignment. I am very tempted to go back to plain ...

Passing the shell to a child before aborting

Current scenario, I launch a process that forks, and after a while it aborts(). The thing is that both the fork and the original process print to the shell, but after the original one dies, the shell "returns" to the prompt. I'd like to avoid the shell returning to the prompt and keep as if the process didn't die, having the child handle...

Can function pointers be used to run "data"?

This is not something most people would probably use, but it just came to mind and was bugging me. Is it possible to have some machine code in say, a c-string, and then cast its address to a function pointer and then use it to run that machine code? ...

Horizontal mouse wheel event? (WinAPI)

My laptop has a trackpad that can do horizontal scrolling aswell as vertical (WM_MOUSEWHEEL) . How can I handle horizontal scrolling? Thanks ...

Problem creating/calling a DLL

Hello I'm trying to create a DLL that will later be used in Inno Setup. I managed to create a DLL using Pelles as an IDE, with the following code: #include <windows.h> __declspec(dllexport) int sumT(){ return 2; } Then I call map the DLL to a function in Inno Setup, using the following Delphi code: function Hellow() : Integer ; ...

"T* ptr" vs "T *ptr" declaration

Possible Duplicate: C++: Asterisks and Pointers First of, excuses if this is a duplicate, it was kind of hard to find any results using the search so I assume it hasn't been asked yet (which I don't believe) As it appears, there's two different pointer (and for C++: reference) declaration conventions. Some people prefer to us...

What datastructure should I use to calculate the factorial of a more than 50 digits long number?

What are some data structures that help me storing and calculating the factorial for numbers with more than 50 digits? ...

Why is the integer not incremented in this code?

Can anyone explain what I'm doing wrong here to not get 11 as my output? void foo { int *n = malloc(sizeof(int)); *n = 10; n++; printf("%d", *n) } ...

Which has a better code base to learn from: nginx or lighttpd?

Primary goal is to learn from a popular web server codebase (implemented in C) with priority given to structure/design instead of neat tricks throughout the code. I didn't include Apache since its code base is an order of magnitude larger than the two mentioned. ...

Programming Games for iPhone

Is it best to program a game for the iPhone in Objective C or in C++. What language would a game like Flight Control be written in? What format should graphics be in to show properly and load quickly on the iPhone? ...

Wanted: Very Fast Linked Lists in C

I am trying to implement a singly linked list in C. A common implementation that you see floating around the internet is something like typedef struct { int head; Node *tail; } Node; with methods like Node cons(int head, Node tail) { Node y; y.head = head; y.tail = malloc(sizeof(Node)); *y.tail = tail; } Performance is ...

Checking for redundant included header files

Is there any way to find out all the redundant header files included in a C/C++ source file? Thanks in advance ...

extract string value from a string

Hello, gcc 4.4.3 c89 I have the following string sip:[email protected] How can I extract just the number? I just want the number. 12387654345443222118765 Many thanks for any advice, ...

reading buffer from socket

I'm writing simple server/client in c, where server temporary stores message from client and retrieve it when client request it. The problem is when client receives message from server, the buffer acts kinda weird. All i did is read as much as receive from server and print it on the screen, but somehow buffer was overwrited more than ma...

Making a barebones, PHP-enabled web server in C?

I want to make the most lightweight possible HTTP server in C that supports PHP and possibly FastCGI if it will make a huge difference. I'm not sure how to implement PHP support. Does it just call PHP.exe with the path to a .php file and read the output? What about things like header () in PHP? How are those handled by the server? And ...

Why do compilers allow string literals not to be const?

And where are literals in memory exactly? (see examples below) I cannot modify a literal, so it would supposedly be a const char*, although the compiler let me use a char* for it, I have no warnings even with most of the compiler flags. Whereas an implicit cast of a const char* type to a char* type gives me a warning, see below (tested...

Library code memory footprint analysis.

Let's say we have a some library compiled into .a file. After that this library is linked with other code into some executable file .exe. Size of .a file is 6Mb while this size of .exe file is 3Mb. Obvious explanation of this is that linker has thrower out unused code from the library. What I want to know is the real library's code footp...

I have a problem with the WIFSIGNALED()/WTERMSIG() macros, after using waitpid()

In this code C i launch a program from the command line and when it is closed from a signal different from SIGTERM (signal for normal end) my code should relaunch the initial program passed from the command line. But it is not so, in fact my code never relaunchs program saying that it is properly terminated.In practice my condition"if(WT...