I'm looking for the good way to add the build directory (which is different from my source directory, a git repository) to the include path for gcc, in order to have the classic "config.h" file for portability seen during the compilation.
...
Is it possible to document C code in Eclipse (3.4 w/ CDT) in such a way that JavaDoc/Intellisense like documentation is auto generated and displayed?
E.g. On typing a function name followed by a '(' you get the first param with a tooltip explaining the meaning of that parameter?
Thanks.
...
I'm writing an access function which returns a pointer to an internal buffer and I'd like to hint to users of my function that they shouldn't update the object that's pointed to. A very contrived example would be:
void myAccessFunc(bool string, void* p, size_t* len)
{
static const char* s = "aha!";
static const int i = 123;
if (...
I'm using Postgres 8.2 and the associated libpq library for ANSI C. I've skimmed the documentation and not found something that would give me that specific information.
In the "COPY" section of the documentation, "Outputs" are described as such:
On successful completion, a COPY command returns a command tag of the form
COPY count
...
There was a bit of a surprise with some code today. I was compiling it on AIX, with the warning level set to anal to see what rogue issues might be lurking. Something new crawled out of the code.
1540-2837 (W) '0' flag is disregarded when combined with
precision and 'i' printf format.
After looking at the offending...
I do alot of programming in *nix using C gcc. I know how to do a basic gethostbyname(). BUt what if I wanted to pull down the entire DNS record. More to the point, is there a function that I'm missing that allows you to specify the specific record that you want to pull? Or will I need to do this manually through a UDP socket?
...
What is the best way to detect in a C program that arrow key is pressed under Linux or Solaris?
As I know there is no standard C function that can do it.
I don't want to use int86 function. I need to do it in a portable way.
Edit: I am asking about console applications.
...
I'm working on some code that generates a lot of
ignoring return value of ‘size_t fwrite(const void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
warnings when compiled with g++, and I'm wondering about the best programming pattern to actually record and handle the return value of a large number of separate se...
Suppose I have a function that allocates memory for the caller:
int func(void **mem1, void **mem2) {
*mem1 = malloc(SIZE);
if (!*mem1) return 1;
*mem2 = malloc(SIZE);
if (!*mem2) {
/* ... */
return 1;
}
return 0;
}
I'd like to hear your feedback on the best way to free() the allocated memory i...
I need to convert between python objects and c strings of various encodings. Going from a c string to a unicode object was fairly simple using PyUnicode_Decode, however Im not sure how to go the other way
//char* can be a wchar_t or any other element size, just make sure it is correctly terminated for its encoding
Unicode(const char *st...
From one thread I got the following code:
int next_stuff(char **code){
...
len=read(file_desc,buffer+end_len,packet_size-end_len);
if(len<=0)
{
if(len==-1 && errno==EAGAIN) return(0);
else return(-1);
}
...
}
while (next_stuff(&buff) == 0)
{
...
}
On the other thread I'd like to fini...
Good day folks, I'm in a need of a bit of guidance.
Basically, I'm a webdev who knows some C from the past, but I've only developed somewhat simple console apps for *nix.
Shortly, I want to develop a simple Win program with a GUI and not get my hands into any of the following technologies:
.NET C#
Java
C++ (especially this one)
Becau...
I haven't done C in a long time. I'd like to compile this program, but I have no idea how to proceed. It seems like the makefile refers to GCC a lot and I've never used GCC.
I just want an executable that will run on windows.
...
I call the function provided by Chris Conway (http://stackoverflow.com/questions/198199/how-do-you-reverse-a-string-in-place-in-c-or-c) from main (C code). When I run this program using cygwin, program crashes when it is in while loop (commented the lines where it breaks). Could you please explain what is going wrong here. Thanks
#inclu...
The following code is generating a stack overflow error for me
int main(int argc, char* argv[])
{
int sieve[2000000];
return 0;
}
How do I get around this? I am using Turbo C++ but would like to keep my code in C
EDIT:
Thanks for the advice. The code above was only for example, I actually declare the array in a function and...
I've seen the word static used in different places in C code; is this like a static function/class in C# (where the implementation is shared across objects)?
...
I want to use the new and delete operators for creating and destroying my objects.
The problem is python seems to break it into several stages. tp_new, tp_init and tp_alloc for creation and tp_del, tp_free and tp_dealloc for destruction. However c++ just has new which allocates and fully constructs the object and delete which destructs ...
I just built an updated version of SDL.dll, an open-source C DLL that my Delphi project uses, with the Express edition of Visual C++ 2005. I dropped it in the folder with my EXE and tried to run it, but it won't load:
The procedure entry point SDL_RWFromFP could not be located in the dynamic
link library SDL.dll.
Now C never was my s...
I have access to a third party library that does "good stuff." It issues status and progress messages to stdout. In a Console application I can see these messages just fine. In a Windows application they just go to the bit bucket.
Is there a fairly simple way to redirect stdout and stderr to a text control or other visible place. Id...
I'm trying to write some STL data out of matlab and I'm trying to do this by writing a MEX File (a matlab DLL written in C) At the moment I have a loop just going through my data writing out the stl syntax with the floats.
...
for(m=0;m<colLen;m++)
{
res = m % 3;
if(res == 0)
{
fprintf(fp, "\tfacet normal %f %f ...