c

Succinctly storing atomic model data for OpenGL program

I want to be able to store an atomic model in an OpenGL program I'm writing. Nothing fancy; just constant mesh vertex values stored as GLfloat[3], plus simple textures. I also want the model to be able to move and rotate freely and as a single object. Here's what I have so far: typedef struct _coordnode { GLfloat *pts; /* ...

How to prove that the C statement -x, ~x+1, and ~(x-1) yield the same results?

I want to know the logic behind this statement, the proof. The C expression -x, ~x+1, and ~(x-1) all yield the same results for any x. I can show this is true for specific examples. I think the way to prove this has something to do with the properties of two's complement. Any ideas? ...

Difference between call by reference and call by value

Possible Duplicate: Difference between value parameter and reference parameter ? What is the difference between call by reference and call by value? ...

Convert numbers with toString in Ansi C

Is it possible to use toString operator, or how to convert numbers to char arrays. ...

Difference between Re-entrant and Thread-Safe function

What is the difference between a re-entrant function and a thread safe function? ...

Are the time functions of MSVC thread-safe?

In case of Linux, for time functions we have a _r versions Ex: localtime has localtime_r, but in Windows I am unable to find some such functions. Are the Windows time functions inherently thread-safe? ...

nested structures allocating memory

Hello, gcc c89 I am getting a stack dump on this line: strcpy(comp->persons->name, "Joe"); However, I have allocated memory, so not sure why I would be getting it. Am I missing something here? Many thanks for any advice, #include <stdio.h> #include <string.h> #include <stdlib.h> struct company { struct emp *persons; char ...

How to initialise the second member of an anonymous structure in C?

I have made a structure for ints and pointers etc. as might be used in LISP. A pointer is at least 8-byte aligned so tag=0. An integer is 29 bits and has a tag of 1. Other types have different tag values. struct Atom{ union{ Pair *pair; struct{ unsigned tag :3; union{ int ...

Conversion from int to char in c

how can i convert integer to char ...

Per-thread locale in linux

Is it possible to specify per-thread in Linux? ...

-isysroot or SDKROOT problem

I am a newbie to libhistory, so I was looking at the sample found with readline library. Compiled it on command prompt using: gcc -o ./a.out /usr/local/share/readline/histexamp.c -lreadline -L/usr/local/lib/It compiles and maintains history. Then crated a xcode project with the same file and linked against readline library it compiles f...

is there any function to get region of a circle in ANSi C?

i need to check that a given point is present or not in the given region of a circle how can i do so is there any function in ansi c to help me? ...

Gettext without process locale

I want to use gettext for i18n. But I need to translate messeges to a different languages. Is it possible to specify a locale for a one gettext call? ...

Logic Issues - Help needed

I am trying to remove spaces from a string in c, not from the end, nor the beginning, just multiple spaces in a string for example hello everyone this is a test has 2 spaces between hello and everyone, and five spaces from this to is. Ultimatley i would want to remove 1 space from the 2 and 4 from the 5, so every gap has 1 space...

Profiling a C or C++ based application that never exits

Hi I have a small doubt regarding profiling applications which never exit until we manually reboot the machine. I used tools like valgrind which talks about memory leaks or bloating of any application which exits after sometime. But is there any tool which can be used to tell about memory consumption, bloating, overhead created by t...

pusha assembly language instruction

I am having a core dump which stack is corrupted. I try to disassemble it and found the following plz help me to anaylyse it .. (gdb) bt #0 0x55a63c98 in ?? () #1 0x00000000 in ?? () (gdb) disassemble 0x55a63c90 0x55a63ca8 Dump of assembler code from 0x55a63c90 to 0x55a63ca8: 0x55a63c90: add %cl,%dh 0x55a63c92: cmpsb %...

how to parse an email message and process various information

Is there any library to parse email messages? I know there are a lot. In addition to basic MIME parsing it should be able to parse things like: If the mail is a forwarded message: parse and tell me the original sender of the message. Get the the parts that should be quoted. I mean like Gmail shows "- Show quoted text -" It should su...

wcstombs segmentation fault

Hello, this code int main (void) { int i; char pmbbuf[4]; wchar_t *pwchello = L"1234567890123456789012345678901234567890"; i = wcstombs (pmbbuf, pwchello, wcslen(pwchello)* MB_CUR_MAX + 1); printf("%d\n", MB_CUR_MAX); printf (" Characters converted: %u\n", i); printf (" Multibyte character: %s\n\n", pmbbuf); ...

Graphic programming over video playback

I want to make some GUI mockup program for video player, so my idea is just to show some menu pictures over real video being playback. I have working program made with C and SDL just to load pictures and make a slideshow, but i don´t know how to put this over video with transparencies. Do you have a hint? ps. i usually program with pyt...

Use ini file in c on Linux

Is there any standard way of reading a kind of configuration like ini files for linux using c? I am working on a Linux based hand held and writing code in c. Otherwise, I shall like to know about any alternatives. ...