I have a .exe and many plug-in .dll modules that the .exe loads. (I have source for both.) A cross-platform (with source) solution would be ideal, but the platform can be narrowed to WinXP and Visual Studio (7.1/2003 in my case).
The built-in VS leak detector only gives the line where new/malloc was called from, but I have a wrapper for...
I'm writing a C/C++ DLL and want to export certain functions which I've done before using a .def file like this
LIBRARY "MyLib"
EXPORTS
Foo
Bar
with the code defined as this, for example:
int Foo(int a);
void Bar(int foo);
However, what if I want to declare an overloaded method of Foo() like:
int Foo(int a, int b);
As the de...
I'm starting a new C project, which is largely OSS-based. It'll also be on SourceForge, and I'd like to take this opportunity to learn established best practices for organizing this kind of code. I'm using libraries like libcurl and libz, and I'll compile it using MinGW and MSYS.
I'll be distributing copies the source of all libraries I...
I did this Just for kicks (so, not exactly a question, i can see the downmodding happening already) but, in lieu of Google's newfound inability to do math correctly (check it! according to google 500,000,000,000,002 - 500,000,000,000,001 = 0), i figured i'd try the following in C to run a little theory.
int main()
{
char* a = "399999...
I am relatively new to the C language, but I'm a very fast learner. I'm looking to do some basic network programming in C but I'm not sure how to start. Could anyone point me to a good guide or tutorial for C Network Programming?
...
I want to to do this, on an 8-bit micro controller
16bit_integer = another_16bit_integer * 0.997;
with the least possible number of instructions.
...
I am about to reenter the MFC world after years away for a new job. What resources to people recommend for refreshing the memory? I have been doing mainly C# recently.
Also any MFC centric websites or blogs that people recommend?
...
Basically I want tools which generate function call graph, dependency graph etc.
...
My C code snippet takes the address of an argument and stores it in a volatile memory location (preprocessed code):
void foo(unsigned int x) {
*(volatile unsigned int*)(0x4000000 + 0xd4) = (unsigned int)(&x);
}
int main() {
foo(1);
while(1);
}
I used an SVN version of GCC for compiling this code. At the end of function fo...
What's the best Python idiom for this C construct?
while ((x = next()) != END) {
....
}
I don't have the ability to recode next().
update: and the answer from seems to be:
for x in iter(next, END):
....
...
I'm trying to learn C. As a C# developer, my IDE is Visual Studio. I've heard this is a good environment for C/C++ development. However, it seems no matter what little thing I try to do, intuition fails me. Can someone give good resources for how to either:
learn the ins and out of C in Visual Studio
recommend a better C IDE + compiler...
With gcc, I want to shift the contents of an array of bytes by 12-bit to the left.
For example, starting with this array:
uint8_t shift[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0x0A, 0xBC};
I'd like to shift it to the left by 12-bits resulting in:
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xAB, 0xC0, 0x00
...
On Windows I can do:
HANDLE hProcess = GetCurrentProcess();
FILETIME ftCreation, ftExit, ftKernel, ftUser;
GetProcessTimes(hProcess, &ftCreation, &ftExit, &ftKernel, &ftUser);
SYSTEMTIME stKernel;
FileTimeToSystemTime(&ftKernel, &stKernel);
SYSTEMTIME stUser;
FileTimeToSystemTime(&ftUser, &stUser);
printf("Time in kernel mode = %uh...
On Windows I can do:
HANDLE hCurrentProcess = GetCurrentProcess();
SetPriorityClass(hCurrentProcess, ABOVE_NORMAL_PRIORITY_CLASS);
How can I do the same thing on *nix?
...
Let's say I'm creating a program in C that needs to use a tempfile. Creating an ad hoc tempfile in /tmp is probably not a good idea. Is there a function or OS call to supply me with a tempfile name so that I can begin to write and read from it?
...
My understanding is that wxWidgets is for a number of programming languages (C++, Python, Perl, and C#/.NET) but that does not include C. Is there a similar framework for the C programming language, or is this not something that C is used for?
...
It has to be in a 'system' C library, not an add-on library, but it can be from any C version/compiler/system/...
Mine's strfry, from glibc, the GNU C library:
The strfry() function randomizes the contents of string by using
rand(3) to randomly swap characters in the string. The result is an
anagram of string.
...
I am looking for a lean and well constructed open source implementation of a B-tree library written in C. It needs to be under a non-GPL license so that it can be used in a commercial application. Ideally, this library supports the B-tree index to be stored/manipulated as a disk file so that large trees can be built using a configurable ...
The product-group I work for is currently using gcc 3.4.6 (we know it is ancient) for a large low-level c-code base, and want to upgrade to a later version. We have seen performance benefits testing different versions of gcc 4.x on all hardware platforms we tested it on. We are however very scared of c-compiler bugs (for a good reason hi...
We're looking for a package to help identify and automatically rotate faxed TIFF images based on a watermark or logo.
We use libtiff for rotation currently, but don't know of any other libraries or packages I can use for detecting this logo and determining how to rotate the images.
I have done some basic work with OpenCV but I'm not...