c

What is an optimal format for saving large amounts of numerical data (GBs) from a C program?

I'm a physicist that normally deals with large amounts of numerical data generated using C programs. Typically, I store everything as columns in ASCII files, but this had led to massively large files. Given that I am limited in space, this is an issue and I'd like to be a little smarter about the whole thing. So ... Is there a better f...

read from stdin for libxml2 in C

Hello, I would like to know the best way to parse a large amount of xml from stdin (data getting piped) into a program I am writing using libxml2. I can parse fine using a reader from the function xmlTextReaderPtr reader = xmlNewTextReaderFilename(filename) when I have a char * to the name of the file. I would preferably like to wind...

Get list of frequently used programs

Hi, I'm making an application that will collect some information on the user computer for statistical reasons, eg. What programs are installed, does it use wired\wireless connection, default browser, Does it use ms office, open office, other?, etc. I want to know what are the most used programs on the computer. I know windows keeps trac...

Calling SHGetSetSettings from Delphi

I just read this question and this question, and since then I have been trying to call SHGetSetSettings in Delphi. This is a function of shell32.dll, but is not defined in ShlObj.pas, so we need to write our own definition. First we need to translate the SHELLSTATE structure. Now I have only limited experience in C, but I suppose that "...

Convert triangle strips to triangles?

I'm using the GPC tessellation library and it outputs triangle strips. The example shows rendering like this: for (s= 0; s < tri.num_strips; s++) { glBegin(GL_TRIANGLE_STRIP); for (v= 0; v < tri.strip[s].num_vertices; v++) glVertex2d(tri.strip[s].vertex[v].x, tri.strip[s].vertex[v].y); glEnd(); } The issue is...

Change current working directory C

Hello, I'm trying to figure out a way where I can change my current output directory using C++ code - and also need that method to be platform agnostic. I found the direct.h header file which is Windows compatible, and the unistd.h which is UNIX/POSIX compatible. Any solutions? Cheers. ...

Where is mistake in this script ?

#include <string.h> #include <stdio.h> char *string = "<aa>RRRR|<aa>SSS|"; char *cmp = "<aa>"; char *p1; int nlen; main() { while ( p1 = strstr(string, "<aa>") ) { nlen = 0; p1 = p1 + 4; while ( ( *p1 != '|' ) && ( *p1 != '\0') ) { p1 = p1 + 1; nlen++; }; p1 = p1 - nlen; string = p1 + 1; cha...

Can I create a "view" on a Python list?

I have a large list l. I want to create a view from element 4 to 6. I can do it with sequence slice. >>> l=range(10) >>> lv=l[3:6] >>> lv [3, 4, 5] However lv is copy of a slice of l. If I change the underlying list, lv does not reflect the change. >>> l[4] = -1 >>> lv [3, 4, 5] Vice versa I want modification on lv reflect in l as ...

pthread_create error

I have client_sock = accept(server_sock, (struct sockaddr *)&client_name, &client_name_len); if (pthread_create(&newthread , NULL, (void * ) accept_request, client_sock) != 0) { perror("pthread_create"); } That's just part of the entire script. Every time I try to compile it, I get warning: passing argu...

c-programming doubt

Possible Duplicates: How do C/C++ compilers work? Do programming language compilers first translate to assembly or directly to machine code? Sir please explain me how internally the code written in C converts into assembly language. ...

Quicksort implementation in C?

I really like the qsort function in C. It's so easy to use and allows me to procrastinate learning C++ template types. I have a few questions about this: Is the algorithm used always a quicksort or is it compiler-implementation-dependent? Would you recommend using this function or is there a real benefit to templates? Are there any thi...

Angle between 3 points?

Given points ABC, how could I find angle ABC? I'm making a feehand tool for a vector drawing application and to minimize the number of points it generates, I wont add a points unless the angle of the mouse position and the last 2 points is greater than a certain threshold. Thanks what I had: int CGlEngineFunctions::GetAngleABC( POINTFL...

using qsort to sort an array

This program is supposed to sort cards, group them and into 5 groups called hands, aparently the code does exactly that, however for some reason am not so sure of, I cannot determine the winer. The winner is supposed to be the value shown as highest among the pairs.eg. if hand one has king as highest pair, and hand 3 has 7 as highest pai...

generate random words from the list of words in c programming

hey, i wanna ask if i have a list of words let say 'tiger, lion, elephant, zebra, horse, camel, deer, crocodile, rabbit, cat' haw can i generate 5 words out of the list randomly in c programming? for example: tiger, zebra, cat, deer, horse or crocodile, rabbit, camel, zebra, elephant ect thank you in advance :D Edit: #include <st...

GTK: Get co-ords of a mouse click in a window

In GTK I can't figure out what callback to setup so that when the user clicks in a window, I can get the X/Y co-ords of the click. ...

Why cant register variables be made global??

While reading from a site a read that you can not make a global variable of type register.Why is it so? source: http://publib.boulder.ibm.com/infocenter/lnxpcomp/v8v101/index.jsp?topic=/com.ibm.xlcpp8l.doc/language/ref/regdef.htm ...

Image Processing Programming

Hi! I wanted to know if there's any way by which we can detect the position of an object in an image using some programming language ? For example : If i have an image of a ball that is updating itself say every 100 milliseconds,is it possible to get the coordinate of the ball through some program,using something like C++ or Java ? Tha...

Detached Threads

When we make Detached threads in main. and supose main exits... do the detached threads keep on going on or do they also exit just like our normal Joinable threads? ...

difference between array and list

what is the difference between array and list? ...

Unnamed parameters in C

In C, unlike C++, all parameters to a function definition must be named. Instead of quashing "unused parameter" errors with (void)a, or openly using __attribute__((unused)), I've created the following macro: #define UNUSED2(var, uniq) UNUSED_ ## line ## var __attribute((unused)) // squash unused variable warnings, can it be done withou...