Difference between preprocessor directives #if and #ifdef
What is the difference (if any) between the two following preprocessor control statements. #if and #ifdef ...
What is the difference (if any) between the two following preprocessor control statements. #if and #ifdef ...
Addresses of 1d arrays are actually taken as a[i]=*(a+i); Are the addresses of 2d arrays calculated as a[i][j]=**(a+i+j); ...
Hi everybody, I have the problem that memcpy/memmove change the pointer of a struct FOO foo, which is neither src nor destination of the function. Here are the gdb outputs: Before memmove(y,y_temp,size_y);: (gdb) p y $38 = 0xbff7a2e0 (gdb) p y_temp $39 = (float *) 0x815ea20 (gdb) p foo $40 = (FOO *) 0x81d4e90 and after: (gdb) p y_t...
Hi All. I have been trying to load .png files with transparency channel (RGB and Alph) with no luck. It appears that openCV strips the 4th channel out of the image. Is there any method to load the image with the complete 4 channels including the alpha channel even if I had to modify the OpenCV source code and rebuild it ...
Hi, I am having a problem with building an application in Visual Studio 2008. I have declared the following in my project properties: _BIND_TO_CURRENT_MFC_VERSION=1 _BIND_TO_CURRENT_CRT_VERSION=1 _BIND_TO_CURRENT_ATL_VERSION=1 When I build my application in VS2008 it generates an intermediate.manifest file which contains: <dependent...
Hello, I need to implement a method that can measure Time and CPU cycles of context switch between threads in Windows. Here is my code #include <stdio.h> #include <windows.h> #include <time.h> LARGE_INTEGER initialTimeStamp, finalTimeStamp, freq; DWORD ThreadProc(LPVOID lpdwThreadParam) { SwitchToThread(); return 0; } int main() ...
I am trying to wrap a c communication library in python and am having some trouble when I attempt to handle large amounts of data. The following code will work for smaller messages but when the message is larger than 400MB I get the following error from the PyObject_CallFunction call: Unhandled exception at 0x1e00d65f in python.exe: 0xC...
Hi, I'm making custom Gtk+ widgets (in C) for work and one of the requirements is that those widgets have to be editable in Glade. So far it works nicely, I have for example a widget made of a table with buttons in it and with a custom specific behaviour and some custom specific properties that can be edited in Glade correctly. So thi...
Hi All. I need to build and use QT within Microsoft visual C 2005 project. Is it possible to do that and how to? ...
I notice that many demos with libnet, they build many headers(ip icmp arp ……) for payload(the data need to be send). I guess the link layer header must be built, because the libnet works in link layer, i am not sure it is right. Now I want to forward some ip packets, can I just only build the ip header? ...
I have a buffer of pixel values. Is it possible to display that buffer as an image using pixbuf in gtk. i will be using c language. ...
hey :) i have a problem. i wrote this code, a.h. a.c and the main.c: file: a.h #ifndef _a_H #define _a_H int poly (int a, int b, int c, int x); int square (int x) { return x*x; } #endif // _a_H file: a.c #include "a.h" int poly (int a, int b, int c, int x) { return a*square(x) + b * x +c; } file: main.c #include <st...
So, I've got a library call init_foo(), and a function bar() that calls it. These live in library.o along with some other useful stuff that both need. I want to write some code, bar_init_failure.t.c, to test what happens when init_foo() fails, without actually setting up the failure. In Perl, the bulk of our codebase, I'd launch Test::R...
I have a question regarding restricted pointer assignments. See the comments in code for specific questions. Overall, I'm just wondering what's legal with restrict (I've read the standard, but still have questions :-( int* Q = malloc(sizeof(int)*100); { int* restrict R = Q; for(int j = 0; j < rand()%50; j++) { R[...
I'm working on a project where I would find a basic plugin system useful. Essentially, I create the base class and can provide this base class to a plugin developer. Then the developer overrides it and overrides the methods. Then this is where it becomes a bit unclear to me. How does it work from here? Where could I find documentation pe...
Consider the following code: #include <stdio.h> #include <ctype.h> char* Mstrupr(char* szCad); int main() { char szCadena[] = "This string should print well."; printf("%s\n", Mstrupr(szCadena)); printf("%s\n", Mstrupr("This string should fail.")); return 0; } char* Mstrupr(char* szCad) { int i; for (i=0; szC...
Hello, I'm writing a brute-force program for enumerating a certain kind of integer sequence (not important what this sequence actually is). In order to get my results, I create a file and I'd like to write all program output to this file. However, it seems that the file "stagnates" at 524 kb even if the program should write something i...
How to return a static multidimensional array of characters? #include<stdio.h> #include<conio.h> #define SIZE 3 char ** MyFunction(void) { static char arr[SIZE][SIZE]={ {'A', 'B', 'C'}, {'D', 'E', 'F'}, {'G', 'H', 'I'} ...
I tried compiling ADPACK, written in C, on an Intel Mac running OX 10.6.4. I got the following error from the make command. gcc -I/usr/local/include -I/home/ozaki/include -c adpack.c adpack.c: In function ‘main’: adpack.c:223: warning: incompatible implicit declaration of built-in function ‘strlen’ gcc -I/usr/local/include -I/home/ozaki...
As those familiar with network device drivers are aware, the interface between the kernel and driver has been changed to use NAPI (New API). In this paradigm, a polling function is associated with a napi_struct, which is a new structure that must be allocated by the device driver. At any rate, I have an old driver and don't have the ti...