c

How to use the grammar files generated by ANTLR?

I think this is a stupid question, but I'm just starting out with ANTLR. I put together the "SimpleCalc" grammar from their tutorials, and generated it with C as the target language. I got SimpleCalcParser.c/.h and SimpleCalcLexer.c/.h as the output, and I was able to compile these and build successfuly. But now, how do I actually use th...

Option Parsers for c/c++?

I've done some looking and there are a whole lot of libraries for command line option parsing, but it is difficult to differentiate between them. Does anyone have any experience with any of them? Is one harder/better/faster/easier/whatever than any of the others? Or should I just grow my own? ...

open source text to speech library

Does any one know of a good text to speech library. It needs to be open source and provide C API? PS: I've already done a search, but I'd like recommendations from people who have actually used these APIs ...

Memory Consumption ?

I have a piece of code where for ( ; ; ) { char *buf; /* Some code */ } The question here will the code allocate memory every time when it cycles through the loop . I mean atleast 4 bytes will be reserved for the pointer when it cycles . ...

Video capture on MacOS

Hi to all! i've a problem with openCV library under MacOs 10.4. When I try to execute this row to save some frame captured from webcam CvVideoWriter *writer = cvCreateVideoWriter( "out.avi", CV_FOURCC('M','J','P','G'), fps, ...

How to automatically generate C header file using CMake?

I'm looking for a way to automatically generate a header file. This file is the public interface of a library and i want to "fill" some structures and stuff before compilation. For example, in the private header I have a structure with useful fields : typedef struct mystuff_attr_t { int _detachstate; mystuff_sc...

How can I buffer non-blocking IO?

When I need buffered IO on blocking file descriptor I use stdio. But if I turn file descriptor into non-blocking mode according to manual stdio buffering is unusable. After some research I see that BIO can be usable for buffering non-blocking IO. But may be there are other alternatives? I need this to avoid using threads in a multi-co...

How to Increment Visual Studio build number using C++?

I have a Visual Studio 2008 project that produces a file called: "Game-Release.exe". This was configured under Project Properties -> C/C++ -> Linker -> General: $(OutDir)\$(ProjectName)-Release.exe I would like to take this a bit further by have an incrementing build number so I would have something which says: Game-Release-Build-10...

C/C++ Programming in Vista

Hey guys, I'm from a Java school, but I'd like to get my hands dirty in C/C++ development as well. Can you suggest: 1) a Lightweight beginner IDE [Eg: JCreator for Java] (Simple and small download) 2) a full-blown advanced IDE [Eg: Eclipse for Java] (Every feature and huge download) 3) should I use GCC or other compilers? Thanks a lo...

Timer to find elapsed time in a function call in C

I want to calculate time elapsed during a function call in C, to the precision of 1 nanosecond. Is there a timer function available in C to do it? If yes please provide a sample code-snippet. Pseudo code Timer.Start() foo(); Timer.Stop() Display time elapsed in execution of foo() Environment details: - using gcc 3.4 compiler on a...

Loading DLL from a location in memory

As the question says, I want to load a DLL from a location in memory instead of a file, similarly to LoadLibrary(Ex). I'm no expert in WinAPI, so googled a little and found this article together with MemoryModule library that pretty much meets my needs. On the other hand the info there is quite old and the library hasn't been updated fo...

Where Can I find a good tutorial for IJG libjpeg

I need to do some work with this library and I'm finding the documentation at http://apodeline.free.fr/DOC/libjpeg/libjpeg.html to be deficient (incomplete function signatures, etc). Does anyone know of some other sides or have some example code illustrating common tasks? [Edit] I also found this question with an example, but any others...

When using a GL_RGBA16F_ARB-texture, it contains just crap, but I get no error message

I generate a texture like this: GLuint id; glGenTextures(1, &id); glBindTexture(GL_TEXTURE_2D, id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D,...

MS3D parsing: boneID == joint ID?

I'm in the planning stage of a MS3D parser and looking through the specs I see that a vertex struct has a boneId variable. Is a "bone" a synonym of a joint? So, is that boneId variable then an index of the joints array? If not, then what is a bone and where does it come into play? I was always under the impression that a bone connects tw...

how badly can c crash?

Hi I have often heard that C can crash spectacularly. Recently I got my first taste of this when a function I expected to return a string instead returned little happy faces. Since then I have been being more careful with initializing pointers and mallocing memory for arrays. Still, though, I have trouble believing that a program could ...

What's the difference between C and C++

I know that C++ has the concept of objects but C doesn't. I also know that pretty much all there is to know about C fits into K & R but the C++ library is vastly more complex. There have got to be other big differences though. What are the major differences between C and C++? ...

How could I improve this Makefile?

I don't know much about creating Makefiles, but I've been reading the make manual and I have made some progress. My Makefile works and does what I want. My situation usually involves between 1 and 3 different program needed to be compiled and sent to my TA for marking and such via a webform. The structure of each application is 'prog.c'...

Problem Creating a Static Lib in Linux

I am making a simple lib to use in my apps to save me the trouble of defining some functions over and over... Here's my makefile: CC=gcc CFLAGS=-Wall -g -Wextra OBJS=getline.o debug.o LIB=libjimi.a .PHONY: clean purge libjimi.so : $(OBJS) ar rcs $(LIB) $(OBJS) @echo done! %.o : %.c $(CC) $(CFLAGS) -c $^ cl...

How can I fold #ifdef/#ifndef blocks in Emacs?

I want to hide blocks of #ifdef and #ifndef blocks in C. Looks like I'd either need to use Folding mode or the Outline minor mode. ...

Why is the following C code illegal?

Consider a typical environment, why is the following code illegal in C? { int x; &x = (int*) malloc(3*sizeof(int)); ... } ...