c

Why hex in string is not converted to hex when passed through command line argument?

What I understand that hexadecimal numbers can be placed into string using \x. For example 0x41 0x42 can be placed in string as "\x41\x42". char * ptr = "\x41\x42" ; printf( "%s\n" , ptr ) // AB \x is discarded and 41 is considered as a hex by the compiler. But if I pass it to my program through command line arguments, it does not wo...

Trouble cross compiling OpenCV for ARM9 Montavista Linux

I'm trying to cross-compile the OpenCV library for using it on an embedded system running Montavista Linux(the system has an ARM926 processor). I've managed to configure and generate the makefiles; the sources are built OK, including the 3rd party libraries. The trouble comes at link time. For some reason libtool picks some libraries fro...

How to debug "glibc detected *** python: malloc(): memory corruption"

Hi All: I'm using python2.5 with scipy.weave to embed c code. In my c code, there is no malloc() function, but I received error like "glibc detected *** python: malloc(): memory corruption" from time to time.(It's a random algorithm) So how shall I debug it out? Thanks ...

how to open new console window using Ansi C?

hello every body i am beginner in Anci c programming here is the description for my program my program first asks user to press any key then a new console is opened and the user inputs any number he want then the console is closed and the number he typed is printed in the parent console ,i hope this clear and thanks for reply so i wa...

Meaning of lone curly-braced code blocks in C.

I've come across a bit of code that contains a couple code blocks, delineated with curly braces {}. There is no line before the code blocks marking them as part of if statements, function definitions, or anything else. Just a code block floating in the middle of a function. Is there any meaning to this? gcc seems perfectly happy going...

Cross platform sound API for games?

Is there an API only for sound? API's such as Allegro or SDL provide too much for my needs. I simply need a library that can do something like: InitSound(); Sound *door = LoadSound("door.wav"); PlaySound(door,volume); It would also be great if it could support compressed formats such as vorbis or mp3. Thanks ...

matrix using pointers

hello, i have problem with the third function (GetMatrix) the others are works. i want to catch data from user into the matrix by poiters only the lines: typedef int pArr[COLS]; void GetMatrix(pArr* ,int , int ); M[ROWS][COLS]; are constraints how i need to do the scan, i try to use scanf("%d",*(M+cols*i+j)) but i get error..its p...

Win API Interlocked operations for 32-bit int type

If we have: __int32 some_var = 0; What is the best (if any) way to call InterlockedExchange, InterlockedIncrement and other interlocked functions which require LONG* for some_var ? Since, there is guarantee that LONG is 32 bit on any Windows, it's probably safe just to pass (long*) some_var. However, it seems to me quite ugly and I c...

How can i access heap memory beside using malloc?

Is there a way that you can assign memory from heap without a call to malloc? Can the following call be affective for it? void* loc = (void*) &heap[end_of_heap]; ...

How to get the C pointer array length?

Is there any method like the Java can .length from a C point array? Thank you. ...

Array index vs. "user documentation" terminology?

I have an "array" of bytes that is referenced in some high-level client/developer documentation (which does not contain any programming language or environment specific information). In this document, bytes are currently referred to as "byte 3" or "byte 17", etc. The development environment is C/C++ and the bytes are stored in an array i...

Statc compiling GLUT?

I have gotten the GLUT 3.7 source and opened the MSVC project. I switched DLL to static lib in the project settings and got a lib. I then linked against it in my application, and added the GLUT_STATIC preprocessor definition. It creates the window and renders one frame of my game and that's it. Whereas the game runs just fine with the dy...

How to create an ASN.1 DER-encoded blob simply.

Greetings, How can I simply encode some binary data into an ASN.1 DER-encoded blob? I'm using C/C++, and I figure it should be possible to simply prefix the binary blob with some appropriate bytes that signify that the data is of type octet string and is of a given length (and in a sequence of length 1 I guess). Background if you're i...

Is there any way by which you can find the max size of a data type?

Possible Duplicate: How would you set a variable to the largest number possible in C? Can we find the maximum size of a data type in C langauge? ...

Confused in how to print an array hellically

I have been trying to figure out how can we print a array hellically but i am stuck on how to get started.Any algorithms or ideas will be very helpful.Thanks HELLICALLY means printing the array in concentric circular shape ...

How does the memory overlap occur and how is it controlled?

While reading about memmove I read that it can handle *MEMORY OVERLAPS*but I am unable to get how a memmory overlap can occur between two strings and how can this function still copy the block of memory correctly. ...

In unix arcitecture what is use of POSIX related with c

hi.... how can i use POSIX header files in system programming? i used <unistd.h> in C. what are other header files i can used? ...

DES implementation in C/C++/C#

I am looking for existing implementations of different types of DES in C/C++/C##. My running platform is Windows XP/Vista/7. I am trying to write a C# program which will encrypt and decrypt using the DES algorithm. I need some implementations with which i can verify my code output to see if i did the things in right order. For the imple...

Waiting for execvp in main

int main() { ... if(!fork()) { execvp(cmdName,cmdParam); } printf("In main()..."); return(0); } Assuming I have correctly passed the cmdName & cmdParam arguments, how do I wait for the process created by execvp to finish, before resuming the execution of main()? Does the execvp() create a proces...

How can we use the output of a program to make further calculations? C (Linux)

When I write code in C, I often get confused when the questions/problems demand the usage of the output for further calculations. For example, if we have to print an array and then add only the prime numbers from it? or something which is similar. I get stuck and I don't know how to tackle such questions. As in when we take input from...