sizeof is a C keyword. It returns the size in a type named size_t. However, size_t is not a keyword, but is defined primarily in stddef.h and probably other C standard header files too.
Consider a scenario where you want to create a C program which does not include any C standard headers or libraries. (Like for example, if you are creat...
Hello!
I want to implement support of the XMLRPC protocol for my server that is written in C and C++ and now looking for the most widely adopted xmlrpc library. License is not an issue, GPL would be fine. What would you suggest ? Is there any defacto standard xmlrpc C library for such a purpose ?
...
Hi there
I just starting using VS2005 and I wish to have code highlighting in C/C++. The VS menu Tools->Options->TextEditor->C/C++ is very poor.
I come from PHP and there the IDE's are very friendly when is about highlighting. I didn't expect that Visual Studio to be so poor at this kind of options.
Can you recommend me a free tool/plu...
I'd like to create a dll library from C++ code and use it in C program.
I'd like to export only one function:
GLboolean load_obj (const char *filename, GLuint &object_list);
Header file from library:
#ifndef __OBJ__H__
#define __OBJ__H__
#include <windows.h>
#include <GL/gl.h>
#include <GL/glext.h>
#include <GL/glu.h>
#include <GL...
What is the sizeof the union in C/C++? Is it the sizeof the largest datatype inside it? If so, how does the compiler calculate how to move the stack pointer if one of the smaller datatype of the union is active?
...
I would like to know if it is possible, using Windows and c++, to take a large video file (several gigabytes in length) and delete the first and last few hundred megabytes of it “in-place”.
The traditional approach of copying the useful data to a new file often takes upwards of 20 minutes of seemingly needless copying.
Is there anythin...
Is the version of C taught by this rather old, but frequently mentioned, book the same as that which is being used in the real world today? If not, could anyone list or point to a list of the differences?
...
I have a program that uses time() and localtime() to set an internal clock, but this needs to be changed so that the internal clock is independent of the user and the "real" time. I need to be able to set any reasonable starting time, and have it count forward depending on a timer internal to the program. Any ideas on the best way to a...
How would one programmaticly determine the version of windows currently installed?
As in differentiate between vista and xp.
...
We have a daemon that reads in data from some sensors, and among the things it calculates (besides simply just reporting the state) is the average time it takes for the sensors to change from one value to another. It keeps a running average of 64 datapoints, and assumes that runtime is fairly constant.
Unfortunately, as demonstrated by ...
Splint gives me the following warning:
encrypt.c:4:8: Function exported but not used outside encrypt: flip
A declaration is exported, but not used outside this module. Declaration can
use static qualifier. (Use -exportlocal to inhibit warning)
encrypt.c:10:1: Definition of flip
Since I called splint only on this file how does i...
I have written a converter that takes openstreetmap xml files and converts them to a binary runtime rendering format that is typically about 10% of the original size. Input file sizes are typically 3gb and larger. The input files are not loaded into memory all at once, but streamed as points and polys are collected, then a bsp is run on ...
Hello!
How can I suppress following warning from gcc linker:
warning: the use of mktemp' is dangerous, better use mkstemp'
I do know that it's better to use mkstemp() but for some reason I have to use mktemp() function.
...
Hey!
I am trying to do something in C with the MD5 (and latter trying to do something with the SHA1 algorithm). My main problem is that I never really did anything complex in C, just simple stuff (nothing like pointers to pointers or structs).
I got the md5 algorithm here.
I included the files md5.c and md5.h in my C project (using cod...
I have the following problem with my C program: Somewhere is a stack overflow. Despite compiling without optimization and with debugger symbols, the program exits with this output (within or outside of gdb on Linux):
Program terminated with signal SIGSEGV, Segmentation fault.
The program no longer exists.
The only way I could detect ...
I have a robot that uses an optical mouse as a position track. Basically, as the robot moves it is able to track change in X and Y directions using the mouse. The mouse also tracks which direction you are moving - ie negative X or positive X. These values are summed into separate X and Y registers.
Now, the robot rotates in place and m...
Hello,
I am wondering what the best practices are for organizing a large C project are. It is a professional project, not an open source one, likely to be stored in a Git repository. How should things be sorted? Where should structures go? When should one use functions attached to structures versus functions that take a structure as a ...
I'm trying to allow two different processes to communicate by using memory mapping the same file. However, I'm having some problems with this. I have a feeling this has to do with the way I'm using the open() call and passing my file descriptor to mmap.
Here is my code, can you see anything wrong with it?
Object 1's code:
16 FIL...
Write a function that given a string of digits and a target value, prints where to put +'s and *'s between the digits so they combine exactly to the target value. Note there may be more than one answer, it doesn't matter which one you print.
Examples:
"1231231234",11353 -> "12*3+1+23*123*4"
"3456237490",1185 -> "3*4*56+2+3*7+490"
"3...
If I have something like the following in a header file:
enum Foo
{
BAR,
BAZ
};
how do I declare a function that returns an enum of type foo? Can I just do something like the following:
Foo testFunc()
{
return Foo.BAR;
}
Or do I need to use typedefs or pointers or something?
...