c

How to compile .c file with OpenSSL includes?

I am trying to compile a small .c file that has the following includes: #include <openssl/ssl.h> #include <openssl/rsa.h> #include <openssl/x509.h> #include <openssl/evp.h> In the same folder where i have the .c file I have a /openssl with all those files (and more), also in synaptic package manager I see OpenSSL installed, I am tryin...

Add C file to Visual Studio

I'm using Microsoft Visual Studio 2010. When I add files to my project, they have a .cpp extension. To work with C, I have to manually rename the files to .c. Is there any way to directly add C files, without renaming anything? ...

Pass va_list or pointer to va_list?

Suppose I have a function which takes variadic arguments (...) or a va_list passed from another such function. The main logic is in this function itself (let's call it f1), but I want to have it pass the va_list to another function (let's call it f2) which will determine the next argument type, obtain it using va_arg, and properly conver...

Comma operators and assigment operators - return values

The following code segment get an output of 32, I am kind of confusing why? int i=(j=4,k=8,l=16,m=32); printf(“%d”, i); ...

What is static block in c or c++?

Hi I want to know that what is static block in c or c++ with an example? I know what is static but what is the difference between static and static block? ...

Handling a variable number of arguments at runtime in a struct

Hello I have to classes, an Executer with these methods: Executer() struct Execute(string s) Lookup(string name, int module, int num, ...) and a Parser: Parser() struct Parse(string s) The Exectuers Execute method calls the Parsers Parse method. The Parser then chucks the string into smaller bits (it explodes the string on the ...

Why does strcat() on a new string craps out undefined characters in the beginning while strcpy is ok?

For example sprintf(pos,"%f ",cl.snap.ps.origin[0]); //don't start with strcat sprintf(tmp,"%f ",cl.snap.ps.origin[1]);strcat(pos, tmp); fine. with sprintf(tmp,"%f ",cl.snap.ps.origin[0]);strcat(pos, tmp); sprintf(tmp,"%f ",cl.snap.ps.origin[1]);strcat(pos, tmp); not fine. ...

C/C++ Header guard consistency

I need a utility to check conflicts in header guards. It would be nice if the utility could check if symbols and file names are consistent (using regex or something). Regards, rn141. EDIT: Example 1. Broken header guard. Doesn't protect from multiple inclusion. // my_file1.h #ifndef my_project_my_file1_h__ #define my_project_my_fil1_...

C: take screenshot

Hi How can I capture screen and save it as am image in C? OS: windows (XP & Seven) Thanks ...

remove characters from a c string

Hello, gcc 4.4.4 c89 I am reading in from a text file and the text file consists of names in double quotes. "Simpson, Homer" etc However, I want to remove the double quotes from the string. This is how I have done it, but I am not sure its the best way. int get_string(FILE *in, char *temp) { char *quote = NULL; /* Get the...

Why using a typedef *after* struct definition?

Both this style: struct _something { ... }; typedef struct _something someting; and that style: typedef struct _something { ... } something; are correct typedef declarations in C. Note that the presence of the structure declaration in the header file is made on purpose: I need to have access to the inner components of the stru...

Get current user's last logon

I am trying to get the current's user last logon. I might be this current session or it might be one before that. I am calling GetUserName() to get the current username. I feed that into NetUserGetInfo() to try to get the last logon time. All this fails with error 2221 (user not found). When I tried with "administrator" it works. Even wh...

Is there anything that i can do in C but not in C++?

Possible Duplicate: Is there something that I can do in C but I cant do in C++ ? I am in a graduate level and I seen that C++ is derived from C with OOP added. I have a doubt that is there anything I can do in C but not in C++. ...

Command line arguments in C

I have this program execute with the values 10,20,30 given at command line. int main(int argc , char **argv) { printf("\n Printing the arguments of a program \n"); printf("\n The total number of arguments in the program is %d",argc); while(argc>=0) { printf("%s ",argv[argc]); argc--; } return 0; }...

Where to begin with programming for robotics?

Ok so i've been interested in robotics for a while and had a project in mind. Building a small remote controlled vehicle-robot/ unmanned vehicle-robot. Hopefully with the ability to read in data from sensory devices(gps,thermometer etc) and write the data to some kind of device. The idea(s) had been on the backburner for a while until i ...

C Tokenizer - How does it work?

How does this work? I know to use it you pass in: start: string (e.g. "Item 1, Item 2, Item 3") delim: delimiter string (e.g. ",") tok: reference to a string which will hold the token nextpos (optional): reference to a the position in the original string where the next token starts sdelim (optional): pointer to a character which will ...

Socket programming in C, using the Select() function.

Based from the answers I got from: http://stackoverflow.com/questions/3366808/multiple-sockets-for-clients-to-connect-to I've create this: //Server sock_init(); //from SFL, see http://legacy.imatix.com/html/sfl/ timeout = 50000; serv_sock_input[0] = TCP(1234); serv_sock_input[1] = UDP(9876); input_protocol...

volatile and multithreading?

In the following code: #include <pthread.h> #include <unistd.h> #include <stdio.h> pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; int ready = 0; wait() { int i; do { usleep(1000); pthead_mutex_lock(&mutex); i = ready; pthread_mutex_unlock(&mutex); } while (i == 0); printf("Fin...

Where's the source of mysqlclient.lib ?

I have a C++ application which connects to a MySQL server. It all works fine. Currently it uses libmysql.dll. At build time I link to libmysql.lib. As far as I understand I can link to mysqlclient.lib instead and get rid of the dependency of libmysql.dll, i.e have the functionality embedded within my exe. My question is: Where can I f...

Windows Application in C

Can anyone tell me how I can create a basic usable Windows application in C (I have a little idea about C++ also) ? ...