I am declaring an array of void pointers. Each of which points to a value of arbitary type.
void **values; // Array of void pointers to each value of arbitary type
Initializing values as follows:
values = (void*)calloc(3,sizeof(void));
//can initialize values as: values = new void* [3];
int ival = 1;
float fval = 2.0;
...
I like to have my code warning free for VS.NET and GCC, and I like to have my code 64 bit ready.
Today I wrote a little module that deals with in memory buffers and provides access to the data via a file-style interface (e.g. you can read bytes, write bytes, seek around ect.).
As the data-type for current read position and size I used ...
I am a CS student currently learning C. I'd like to get into low level programming, whether as a hobby or career and may contribute to some open source projects down the line. So far I really enjoy C and think I will continue down the abstraction level and take ASM next semester.
The question I have is this, is knowing C enough to be a...
I am new to C and i have this question. why does the following code crash:
int *a = 10;
*a = 100;
...
I have seen this macro defined before but never really knew its purpose. Can anyone shed light on this?
...
I am just now learning about function pointers and as I was readying the K&R chapter on the subject the first thing that hit me was, "Hey, this is kinda like a closure." I knew this assumption is fundamentally wrong somehow and after a search online wasn't really to find any analysis of this comparison.
So why are C style function point...
I'm trying to write an audio analysis application, and I need to identify local maxima in a 2D array which represents a spectrogram. I've already got an open source library that can generate the spectrogram using Fast Fourier Transforms, but I was wondering if anybody knew of any good libraries to help me with actually finding the maxima...
I am working on C++ and COM/ATL in Windows from last few years. Now I want to shift to Linux Programming. I know basic architecture of Linux. I did some of the projects which are using ncurses, sockets and audio libraries(Terminal Applications). On which tool I should be familiar to start with projects. In windows I have started with Win...
What are the easiest steps to make a small circuit with an LED flash from a C/C++ program?
I would prefer the least number of dependencies and packages needed.
What port would I connect something into?
Which compiler would I use?
How do I send data to that port?
Do I need to have a micro-processor? If not I don't want to use one for ...
I want to get other process' argv like ps.
I'm using Mac OS X 10.4.11 running on Intel or PowerPC.
First, I read code of ps and man kvm, then I wrote some C code.
#include <kvm.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/sysctl.h>
#include <paths.h>
int
main(void) {
char errbuf[1024];
kvm_t *kd ...
Why is it that scanf() needs the L in "%lf" when reading a double, when printf() can use "%f" regardless of whether its argument is a double or a regular-precision float?
Example code:
double d;
scanf("%lf", &d);
printf ("%f", d);
...
In xp 32bit this line compiles with not problem however in vista 64bit this line:
m_FuncAddr = ::GetProcAddress (somthing);
gives the following error
error C2440: '=' : cannot convert from
'FARPROC' to 'int (__cdecl *)(void)'
GetProcAddress is defined as
WINBASEAPI FARPROC WINAPI GetProcAddress (somthing)
And m_FuncAddr as...
I'm quite new to programming, and I was wondering if there is a good source of well-programmed non-standard C code and libraries.
I Googled and didn't find anything.
I was a bit surprised by this, especially because I used to search for many Python examples and libraries and never had trouble finding anything.
I already use standard l...
The published code for Palm OS applications doesn't include standard headers, but instead uses Palm OS APIs for things like StrCopy and MemMove. Can I use standard headers and functions or do I need to convert my code to use the Palm OS versions?
...
I need to do a fast case-insensitive substring search in C/C++. My requirements are as follows:
Should behave like strstr() (i.e. return a pointer to the match point).
Must be case-insensitive (doh).
Must support the current locale.
Must be available on Windows (MSVC++ 8.0) or easily portable to Windows (i.e. from an open source librar...
This is not a question about which of the two languages is better than the other. I myself can't really decide. Pros and cons as always I guess.
Also, if you feel you always would prefer C over C++, this poll is not for you :-).
However, when I work in C projects I usually feel I'm missing a few language constructs more than others, wh...
I'm sure this problem has been solved before and I'm curious how its done. I have code in which, when run, I want to scan the contents of a directory and load in functionality.
Specifically, I am working with a scripting engine that I want to be able to add function calls to. I want the core engine to provide very limited functionality....
What does the "bus error" message mean, and how does it differ from a segfault?
...
I tried "x = y ** e", but that didn't work.
...
Hi,
Can you recommend peer reviewed libraries that I can use in C environment (something like Boost for C++) ? Something that provides hash, thread, interprocess communications, lists, smart memory management...
The environment is embedded system, not a very minimal system, but also not a PC!
Thanks!
Amit
...