c

CURL C API: callback was not called

Hi all, The code below is a test for the CURL C API . The problem is that the callback function write_callback is never called. Why ? /** compilation: g++ source.cpp -lcurl */ #include <assert.h> #include <iostream> #include <cstdlib> #include <cstring> #include <cassert> #include <curl/curl.h> using namespace std; static size_t writ...

Vertical Rebar (WinAPI)

I was wondering if it was possible to make a Rebar that goes vertically instead of controls horizontally? Thanks ...

Angle between 3 vertices

For example, GetAngle((0,0),(100,0),(100,100)) = 90. How could I find the angle between 3 2D Points. ...

Misaligned Pointer Performance

Aren't misaligned pointers (in the BEST possible case) supposed to slow down performance and in the worst case crash your program (assuming the compiler was nice enough to compile your invalid c program). Well, the following code doesn't seem to have any performance differences between the aligned and misaligned versions. Why is that? ...

Write failed, errno 0

I have a client server situation in which I receive data using read(socket, char_buf, BUF_SIZE) and then try to write it into a log file using write(filefd, char_buf, strlen(char_buf)) Strangely enough this fails (write returns -1), and yet the errno is set to 0, and I can print the message, AND the log file descriptor works (I w...

Setting the default stack size on Linux globally for the program

So I've noticed that the default stack size for threads on linux is 8MB (if I'm wrong, PLEASE correct me), and, incidentally, 1MB on Windows. This is quite bad for my application, as on a 4-core processor that means 64 MB is space is used JUST for threads! The worst part is, I'm never using more than 100kb of stack per thread (I abuse th...

How to extract frequency information from samples from PortAudio using FFTW in C

Hi all, I want to make a program that would record audio data using PortAudio (I have this part done) and then display the frequency information of that recorded audio (for now, I'd like to display the average frequency of each of the group of samples as they come in). From some research I've done, I know that I need to do an FFT. So I...

scanf() (C Language ) confused me

Hello. When do I need to insert/don't insert & for scanf() in C? Thank you. int main() { char s1[81], s2[81], s3[81]; scanf("%s%s%s", s1, s2, s3); // If replace scanf() with the expression below, it works too. // scanf("%s%s%s", &s1, &s2, &s3); printf("\ns1 = %s\ns2 = %s\ns3 = %s", s1, s2, s3); return 0; } ...

Raw OpenGL equivillant of GLUPerspective?

how could I do the same as GluPerspective without Glu? Thanks ex: gluPerspective(45.0, (float)w / (float)h, 1.0, 200.0); ...

xcode compile console application - c programming

Is it possible to use Xcode using iPhone 3.1.3 SDK to compile a standard C program that will work on the iphone? I'm trying to use xcode to compile a basic 'hello world' but to no avail. Do I need to obtain an additional application template or am I just missing something? ...

OpenGL polygons stuck at top left?

I'm using theallegro library and through it OpenGL. I enable depth testing, then upon resize I do: glEnable(GL_CULL_FACE); glCullFace(GL_BACK); glEnable(GL_DEPTH_TEST); glMatrixMode(GL_PROJECTION); glLoadIdentity(); glFrustum(0,event.display.width,event.display.height,0,1,300); Then my drawing looks like: floa...

winsock compile error

The following errors are from a file with just windows and winsock2 included. C:\Users\ioil\Desktop\dm\bin>dmc sockit.c typedef struct fd_set { ^ C:\Users\ioil\Desktop\dm\bin\..\include\win32\WINSOCK2.H(85) : Error: 'fd_set' is already defined } fd_set; ^ C:\Users\ioil\Desktop\dm\bin\..\include\win32\WINSOCK2.H(88)...

Compiling C Source with Makefile in Windows

I'm trying to compile a downloaded program in Windows. The program is usually run in Linux, but is programmed to also run in Windows (the code has #if defined(_WIN32)'s in it, and claims to work with borland free tools). When I try to use make from the command line, it tells me "Incorrect command line argument: -C". In the makefile, t...

Change window title - `GTK_IS_WINDOW (window)' failed

Hello, I want to change titlie of main window of my C/gtk+ application. I have code: void update_title(const char *filename, MainWin* mw ) { GtkButton* btn = gtk_button_new(); static int wid, hei; static char fname[50]; char buf[100]; if(filename != NULL) { strncpy(fname, filename, 49); wid = gdk_pi...

what does int (*a)[10]

Possible Duplicates: Interpretation of int (*a)[3] What does char (*a)[12] mean ? i would really appreciate if you can explain with help of program ...

Compile OpenCL kernels with debug information?

How can I compile opencl kernels with debug information? If i do it like hear debugging [const char* options = "-g"; clBuildProgram( *hProgram, 0, 0, options,NULL,NULL);]: i get following error: clang: Unknown command line argument '-g'. Try: 'clang --help' ...

"Socket operation on non-socket" error due to strange syntax

I ran across the error Socket operation on non-socket in some of my networking code when calling connect and spent a lot of time trying to figure out what was causing it. I finally figured out that the following line of code was causing the problem: if ((sockfd = socket( ai->ai_family, ai->ai_socktype, ai->ai_protocol) < 0)) { See th...

Communicate with iDevice via C?

I have seen this being done by the jailbreaking program, Spirit. I would just like to return simple information like the what kind of iDevice (like iPhone 3G, iPod touch 3G, iPad). Would this be very hard to do, or something kind of simple. (Such as: idevice_t *device; device->version) ...

How to compile a C DLL for 64 bit with Visual Studio 2010?

I have a DLL written in C in source code. This is the code for the General Polygon Clipper (in case you are interested). I'm using it in a C# project via the C# wrapper provided on the homepage. This comes with a precompiled DLL. Since switching to a 64bit Development machine with Visual Studio 2010 and Windows 7 64 bit, the application...

Can the dirtiness of pages of a mmap be found from userspace?

Can dirtiness of pages of a (non-shared) mmap be accessed from userspace under linux 2.6.30+? Platform-specific hacks and kludges welcome. Ideally, I'm looking for an array of bits, one per page (4kB?) of the mmap'ed region, which are set if that page has been written to since the region was mmap'ed. (I am aware, that the process doin...