c

C array pointer question

I thought that an array variable cannot be changed in C, i.e. the base address of an array is unchangeable, but the following code contradicts my assumption : #include <stdlib.h> #include <stdio.h> void changeArray(int **a) { *a = malloc(sizeof(int)); } int main() { int a[10]; a[0] = 1; printf("%d\n",a[0]); changeArr...

Sending buffer length and buffer over socket in c

Hello, I'm trying to send a string to a server application using C, but I've hit a snag. I'm fairly new to network programming, and I think my code is barking up the wrong tree. The message is supposed to be message length + message and is unpacked on the other side by a python server as such (buf being the raw incoming data): msg_len...

IDE for Objective C

What are the IDE's or development tools best suited for projects involving Objective C, C and C++? Is there a common IDE which would support all the three languages. ...

Can i inherit structure in C?if yes how?

Can i inherit structure in C?if yes how? ...

how can I find last node of a circular linked list whose size I dont know and the last node points to any other node except first node of the linked list?

how can I find last node of a circular linked list whose size I dont know and the last node points to any other node except first node of the linked list? ...

Why can't I use colorkey for SDL textures?

I wrote up this simple C program to test basic SDL 1.3 functionality. Everything works, with one minor problem. The colorkey doesn't get converted. I'm loading an 8-bit PNG sprite file where palette index #0 is the background color. I'd expect to see only the sprites displayed, but what I get is the entire image, including the backgro...

Making a Makefile

How I can make a Makefile, because it's the best way when you distribute a program by source code. Remember that this is for a C++ program and I'm starting in the C development world. But is it possible to make a Makefile for my Python programs? ...

convert int to char c

is there a way to convert int to char ? edit : here is the problem with Jeff Johnson answer (it shows weird characters): ...

How Do I Create Cheap Shadows In OpenGL?

I have two models, A and B, and one light, L. I would like model A to cast a shadow on model B. I don't want to bother with shadow volumes or proper shadows for the moment, just a simple circle shadow will suffice. The effect is that model A is treated as a sphere for shadow casting purposes. Here is how I envision the algorithm: Fo...

How can I convert Perl to C?

Is there a tool available which will convert source code in Perl to source code in C? Any platform is fine. ...

default argument value in C

Is it true this is not supported? Answer: It is not supported. ...

Detect when a USB device is connected in C

I am new to C and am trying to write a program that syncs files on my computer to a USB device. It currently works my me cd'ing to the directory that the device mounts to and typing "myprog init" which creates a .myprog file. The idea then is that when a USB device is connected my program checks for the .myprog file, if it finds it then ...

How to compile a C file without visual studio

I have visual studio 2008. I have a written a small C program. I want to compile that C file in command prompt. How do i do that ? please point me to a place where i can learn more about working with projects without visual studio. thanks ...

Is assert and unit-testing incompatible?

Hello, I have some concerns related to the fact of testing some functions containing the assert macro from assert.h. If the assert fails the test fails also. This leaves me with some test cases that will never work. For example a function instead of indicating failure (return false or something similar) asserts. Is there a solution f...

Suggested reading order and other questions....

Based on recommendations from episode 57 of the StackOverflow Podcast, I have purchased "Structure and Interpretation of Computer Programs", "The C Programming Language", "Unix Programming Environment", and "Introduction to Algorithms". I'm wanting to improve my fundamental programming skills, contribute to some open source projects, and...

Where can I see the list of functions that interact with errno?

In the book "The C Programming Language" it says: "Many of the functions in the library set status indicators when error or end of file occur. These indicators may be set and tested explicitly. In addition, the integer expression errno (declared in <errno.h>) may contain an error number that gives further information about the mo...

Can scanf identify a format character within a string?

Let's say that I expect a list of items from the standard input which are separated buy commas, like this: item1, item2, item3,...,itemn and I also want to permit the user to emit white-spaces between items and commas, so this kind of input is legal in my program: item1,item2,item3,...,itemn If I use scanf like this: scanf("%...

How to find the number of parameters to a Python function from C?

I'm using the Python C API to call Python functions from my application. I'd like to present a list of functions that could be called and would like to be able to limit this list to just the ones with the expected number of parameters. I'm happy that I can walk the dictionary to extract a list of functions and use PyCallable_Check to fi...

concating 2 unicode strings - how to do that ?

hello everyone, I have 2 unicode strings which I like to concat. everytime I try to concat using RtlAppendUnicodeStringToString it telling me "STATUS_BUFFER_TOO_SMALL", even though im increasing my destination unicodestring.length to big numbers. what is the method to concat 2 unicode strings ? thanks ...

More Control Over C Standard Output

I can't seem to find the right way to ask the almighty google... In such programs as a command-line progress bar, the output buffer seems to be directly manipulated. It can't print a character to a terminal in any place it wants. How is such control over a program's output controlled in standard C? Is there a special library that I c...