c

understanding a Build c++

I think I know what a build is. But I am not sure. My definition of a build is another word for saying compiled application. Can someone please tell me what exactly a build is. And why do people ask for 3 types of builds. Such as Debug Build, Profile Build and a Release Build. What are the differences. [edit] the types of builds ...

Creating a good directory structure

This might be a silly question but I am still learning. I have read several books on creating application and creating a good directory structure. When people talk about creating a directory structure, do they mean the folders you make within the solution explorer (folders you actually find inside of a .sln file) or do they mean setting ...

Embedding binary blobs using gcc mingw

I am trying to embed binary blobs into an exe file. I am using mingw gcc. I make the object file like this: ld -r -b binary -o binary.o input.txt I then look objdump output to get the symbols: objdump -x binary.o And it gives symbols named: _binary_input_txt_start _binary_input_txt_end _binary_input_txt_size I then try and acce...

how to call a dll file in c. I want to transmit a xml file to it.

I found many ways, but they are too easy, they always get a return-value from the dll file. dll file: a file with the sufix ".dll" ...

what's wrong in my C program ?

a cpp file: #include <iostream> #include <jni.h> #include "Hello.h" #include "windows.h" #include "stdafx.h" typedef void(__stdcall *Print_)(); int main(){ HINSTANCE hDll; //DLL句柄 Print_ print_; //函数指针 hDll = LoadLibrary("Hello.dll"); if (hDll != NULL) { print_ = (Print_)GetProcAddress(hDll,"Java_Hello_sayHello@...

c programme.. how to delete spaces between two words.

how to delete space between two words using c programme... should I use ascii or just compair with ''? eg. Input- "Hello World" Output-"HelloWorld". Thanks, Vikram ...

Why do C compilers prepend underscores to external names?

I've been working in C for so long that the fact that compilers typically add an underscore to the start of an extern is just understood... However, another SO question today got me wondering about the real reason why the underscore is added. A wikipedia article claims that a reason is: It was common practice for C compilers to prep...

Weak-linking with static libraries

I have declared an external function with a GCC weak attribute in a .c file: extern int weakFunction( ) __attribute__ ((weak)); Compiled object file has weakFunction defined as a weak symbol. Output of nm: 1791: w weakFunction I am calling the weak defined function as follows: if (weakFunction != NULL) { weakFunction()...

How do I run a C program from VIM ?

Is there a way to compile and run a C program from VIM without typing its filename ? ...

Do console apps run faster than GUI apps?

I am relatively new to world of programming. I have a few performance questions: Do console apps run faster than apps with a graphical user interface? Are languages like C and Pascal faster than object oriented languages like C++ and Delphi? I know language speed depends more on compiler than on language itself, but do compilers for pr...

macro function for printing

Hi, if for example i have : #define PRINT(x) fprintf(stderr, x); and in code i append it : PRINT(("print this")) output is : [print this] if i append it : PRINT(("print %s", "this")) output is : [this] could someone explain me why it receives just the "this" argument and not the whole string ? ...

C/GCC - Is it possible to sort arrays using preprocessor? [SOLVED]

I have a number of very long arrays. No run-time sort is possible. It is also time consuming to sort them manually. Moreover, new elements can be added in any order later, so I would like to sort them by value using C preprocessor or maybe there is any compilers flag (GCC)? For example: sometype S[] = { {somevals, "BOB", someotherva...

Is there table with timing(cost) of C functions?

Preferable for x86-32 gcc implementation ...

Where i can find implementation of time.h <C Standard Library>

Where i can find implementation of time.h i.e time.c I tried with Google Code Search time.c Is the implementaion is in Linux Kernel ? ...

Are there any pitfalls when calling functions from a C library in a C++ program?

I'm using a library which has both a C interface and a C++ interface in my C++ program. The C++ one is a bit immature and I must stick with the C one. I was wondering, in more general terms, is there anything specific to keep in mind when mixing C-style binary object files with a C++ project? ...

Parenthesis operator in C. What is the effect in the following code

Hi everyone, I was playing with a macro to enable/disable traces when I came out with the following code when the macro is disabled: int main() { ("Hello world"); } This code is valid and I got the desired effect (nothing happens when the macro is disabled) but I couldn't figure out what exactly is happening. Is the compiler seei...

Redundant naming in C/C++ typedefs/structs

#include <stdio.h> #include <string.h> const int NAMELEN=30; const int MAXCLASSSIZE=10; typedef struct StudentRec { char lastname[NAMELEN]; char firstname[NAMELEN]; long int ID; int finalmark; }Student; I'm new to coding..and I have a question about why there is Student; after the bracket.. is it a format that we hav...

Dynamic linking in Visual Studio

I have to link dynamically with OpenSSL libeay32.dll. I'm writing native c++ console application using Visual C++ Express 2008. I'm including a header evp.h from OpenSSL distribution. Building and...: error LNK2001: unresolved external symbol _EVP_aes_256_cbc error LNK2001: unresolved external symbol _EVP_DecryptInit error LNK2001: un...

C - How to implement Set data structure?

Is there any tricky way to implement a set data structure (a collection of unique values) in C? All elements in a set will be of the same type and there is a huge RAM memory. As I know, for integers it can be done really fast'N'easy using value-indexed arrays. But I'd like to have a very general Set data type. And it would be nice if a...

How to printf a time_t variable as a floating point number?

Hi guys, I'm using a time_t variable in C (openMP enviroment) to keep cpu execution time...I define a float value sum_tot_time to sum time for all cpu's...I mean sum_tot_time is the sum of cpu's time_t values. The problem is that printing the value sum_tot_time it appear as an integer or long, by the way without its decimal part! I tried...