c

My Current Project Needs to Snapshot a website.

My Current Project Needs to Snapshot a website, the whole website and a thumbnail, with an inputed url. How can i get it done in C, C++? ...

how to get ip address from sock structure in c ?

I'm writing simple server/client and trying to get client ip address and save it on server side to decide which client should get into critical section. I googled it several times but couldn't find proper way to get ip address from sock structure. I believe this is a way to get ip from sock struct after server accept request from client...

error in c, but not in c++

const int t=5; char buf[t+5]; When I compile this gives error in C but not in C++!! Can anybody please explain me the reason? Note: I know the const defaults to internal linkage in 'C++', where as in 'C' it defaults to external linkage. Does it has any relation to the above case?? ...

Better to use an OR or an AND when checking for NULLs in C if statements?

Came across a line in OpenSSL that made me do a double take... if (!*pos) return NULL; if (!*pos || ((*pos)->flags == FLAGS)) return blah; Is there a (performance/security/concurrecy) difference in doing that instead of: if (!*pos) return NULL; if (*pos && ((*pos)->flags == FLAGS)) return blah; Thanks, Chenz ...

3D modeling using camera

Hi, I'm looking for a sample code. It's 3D modeling using camera. like this: http://mi.eng.cam.ac.uk/~qp202/my_papers/BMVC09/ Hopefully, I want to use c or c++. Thanks. ...

Differentiate VMware network adapter from physical network adapters

I have to differentiate between the real addresses and the VM addresses using any Windows API. I'm using Getadaptersaddresses API to populate a list of ipaddresses for the local machine. I need to extract only the "real" addresses apart from the addresses associated with the VMware network adapter and other addresses(auto-configuration a...

How can I customize the cpu in visual stadio

I need to test my program on a specific environment. I want to know how I can customize the cpu or ram usage, or see what will happen when I run my program to the hardware. I need this information: memory usage cpu usage ...

Special simple random number generator

How to create a function, which on every call generates a random integer number? This number must be most random as possible (according to uniform distribution). It is only allowed to use one static variable and at most 3 elementary steps, where each step consists of only one basic arithmetic operation of arity 1 or 2. Example: int myr...

malloc hangs in Linux

I am using SUSE 10 Linux on a machine with 16 G ram and 2 quad core CPUs. There are 8 processes which are doing some work (CPU intensive/network i/o). Out of which 4 have a memory leak (These are test conditions so no problem in having leaks here). Total space is occupied by all processes is around 15.4 G only 200 MB is free in system. ...

Does speed of an C/C++, Windows console application depend on whether the target is 32 or 64 bit?

Supposing that memory is not an issue does targeting a 64 bit OS make a C/C++ Windows console application run faster? Update: Prompted by a few comments/answers the application involves statistical algorithms (e.g., linear algebra, random number draws etc). ...

Declaring two large 2d arrays gives segmentation fault.

Hello, i'm trying to declare and allocate memory for two 2d-arrays. However when trying to assign values to itemFeatureQ[39][16816] I get a segmentation vault. I can't understand it since I have 2GB of RAM and only using 19MB on the heap. Here is the code; double** reserveMemory(int rows, int columns) { double **array; int i; ...

Gradual memory leak in loop over contents of QTMovie

I have a simple foundation tool that exports every frame of a movie as a .tiff file. Here is the relevant code: NSString* movieLoc = [NSString stringWithCString:argv[1]]; QTMovie *sourceMovie = [QTMovie movieWithFile:movieLoc error:nil]; int i=0; while (QTTimeCompare([sourceMovie currentTime], [sourceMovie duration]) != NSOrderedSame) ...

Prob comparing pointers and integer in C

Hi I have a problem with this code. When i am using this function I have no warnings. : void handler(int sig){ switch(sig) { case SIGINT : { click++; fprintf(stdout,"SIGINT recu\n"); if( click == N){ exit(0); } } case SIGALRM : fprin...

Problem with exuberant ctags on Mac OS X

I'm trying to generate tags for the C Standard Lib using Exuberant Ctags 5.8, however it seems that the headers are not parsed completely... For example, when I generate the tags for /usr/include/string.h, I get this: !_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ !_TAG_FILE_SORTED 1 /0=unsorted, 1...

Malloc to a CGPoint Pointer throwing EXC_BAD_ACCESS when accessing

I am trying to use a snippet of code from a Apple programming guide, and I am getting a EXC_BAD_ACCESS when trying to pass a pointer to a function, right after doing a malloc. (For Reference: iPhone Application Programming Guide: Event Handling - Listing 3-6) The code in question is really simple: CFMutableDictionaryRef touchBeginPoin...

Generating code at compile-time using scripts

Hello, I would ideally like to be able to add (very repetitive) C/C++ code to my actual code, but at compile time, code which would come from say, the stdout of a python script, the same way one does with macros. For example, let's say I want to have functions that depend on the public attributes of a given class, being able to just wr...

Throughput calculation using cycle count

Is it possible to determine the throughput of an application on a processor from the cycle counts (Processor instruction cycles) consumed by the application ? If yes, how to calculate it ? ...

Read a file address from a txt file using netbeans c

Hi everybody. I`m having problems reading a file address from a txt file. The information seems to be corrupted when I watch it in the debugger. The code is FILE *parch; const char * vectorparch[50]; //array with 50 file paths parch = fopen("/home/irmay/NetBeansProjects/neurona/patrones/patrones.txt", "r"); for(j=0;j<50;j++){ fread...

How is vector implemented in C++

I am thinking of how I can implement std::vector from the ground up. How does it resize the vector? realloc only seems to work for plain old stucts, or am I wrong? ...

parsing string off a configuration using strtok in C

in the configuration file i have entries similar to this one: filepath = c:\Program Files\some value Where the path can contain spaces and there are no quotes on that string. I tried parsing this with strtok like: char *option; char *value; value = strtok(line, " ="); strcpy(option, value); value = strtok(NULL, " ="); where line is...