c

Best ways of parsing a URL using C?

I have a URL like this: http://192.168.0.1:8080/servlet/rece I want to parse the URL to get the values: IP: 192.168.0.1 Port: 8080 page: /servlet/rece How do I do that? ...

Help required in WinAvr programming

hello, i am trying to run a source code of win avr . after making the makefile when i try to send it using avrdude it is giving me error. Please any one can help me ...

Objective-c superset of C

How is objective-c possibly a superset of C? It makes no sense. There is no stack in objective-c from what I can tell. Also, in C there is no need to use [] whenever invoking a method. Please explain. ...

How do you convert a Visual Studio project from using wide strings to ordinary strings.

When I created my visual studio project it defaulted to forcing me to use wide strings for all the functions which take character strings. MessageBox() for example, takes a LPCWSTR rather than a const char*. While I understand that it's great for multi-lingual and portable applications, it is completely unnecessary for my simple little a...

Why does this variadic function fail on 4th parameter on Windows x64?

Below is code which includes a variadic function and calls to the variadic function. I would expect that it would output each sequence of numbers appropriately. It does when compiled as a 32-bit executable, but not when compiled as a 64-bit executable. #include <stdarg.h> #include <stdio.h> #ifdef _WIN32 #define SIZE_T_FMT "%Iu" #else ...

Partial Least Squares Implementation for C/C++?

Does anyone know of an open-source implementation of a partial least squares algorithm in C or C++? ...

What happens when GetTickCount() wraps?

If a thread is doing something like this: const DWORD interval = 20000; DWORD ticks = GetTickCount(); while(true) { DoTasksThatTakeVariableTime(); if( GetTickCount() - ticks > interval ) { DoIntervalTasks(); ticks = GetTickCount(); } } Eventually, ticks is going to wrap when the value doesn't fit in a ...

Three arguments to main, and other obfuscating tricks.

The following obfuscated C code prints the words to the "12 days of Xmas". I was trying to puzzle out how it works. I'm basically completely lost. What is the significance of the three untyped arguments to main in the initial call, the series of characters after the first return, the negative numeric arguments to the calls to main? Eek...

How does a string differ from an array of char pointers in C?

I was under the impression that they were the same thing. However, it looks to my like they are being treated differently here. The part I am confused about looks like this. Foo* initFoo(char* name); int main { Foo* foo; char* player_name[25]; scanf("%s", player_name); foo = initFoo(player_name); } Foo* initFoo(char* name) { ...

Carriage return required when printing to the console in Windows?

It seems like just putting a linefeed is good enough, but I know it is supposed to be carriage return + line feed. Does anything horrible happen if you don't put the carriage return and only use line feeds? This is in ANSI C and not going to be redirected to a file or anything else. Just a normal console app. ...

VoIP on windows [C]

Is there any widespread library's/API's that allow you to work with VoIP ? I mean like a VoIP version of sockets or something.. ...

What's the equivalent of C's "static" keyword in Java?

Dear all,, I want to know what could be the equivalent keyword in java which could perform same function as "Static keyword in C".. I want to do recursion in java, performing same function that a static keyword in C does... Please help.. ...

Passing C array as char* function parameter

I've got some code I'm mantaining with the following variable declaration: char tmpry[40]; It's being used with this function: char *SomeFunction(char *tmpryP) { // Do stuff. } The function call is: SomeFunction(&tmpry[0]); I'm pretty damn sure that's just the same as: SomeFunction(tmpry); I've even checked that the char* ...

What is faster- Java or C# (Or good old C)?

I'm currently deciding on a platform to build a scientific computational product on, and am deciding on either C#, Java, or plain C with Intels compiler on Core2 Quad CPU's. It's mostly integer arithmetic. My benchmarks so far show Java and C are about on par with each other, and dotNET/C# trails by about 5%- however a number of my cow...

Recommendations for encrypting/decrypting scripts elegantly?[Now on Sourceforge]

Update2: Thanks for the input. I have implemented the algorithm and it is available for download at SourceForge. It is my first open source project so be merciful. Update: I am not sure I was clear enough or everyone responding to this understands how shells consume #! type of input. A great book to look at is Advanced Unix Program...

C integer overflow behaviour when assigning to larger-width integers

If I execute the following code in C: #include <stdint.h> uint16_t a = 4000; uint16_t b = 8000; int32_t c = a - b; printf("%d", c); It correctly prints '-4000' as the result. However, I'm a little confused: shouldn't there be an arithmetic overflow when subtracting a larger unsigned integer from the other? What casting rules are ...

tiny memory manager

I have a chunk of memory, let us say 'NN'MB. I want a custom memory manager that will only allocate from this memory. The memory manager should be capable of allocating, freeing using the chunk already available. It will be great if it can also handle fragmentation. Edited: I looking for some open source in C, or is there some API like...

How to execute some code before entering the main() routine in VC?

I am reading Microsoft's CRT source code, and I can come up with the following code, where the function __initstdio1 will be executed before main() routine. The question is, how to execute some code before entering the main() routine in VC (not VC++ code)? #include <stdio.h> #pragma section(".CRT$XIC",long,read) int __cdecl __initstd...

Shifting All Strings Up in Array (Problem with realloc)

I'm trying to write a function that shifts all the elements in an array of strings up by one. void shift_frags(char **frags, int frag_len, int cur) { int i; for(i = cur; i < frag_len-1; i++) { if(strlen(frags[i+1]) > strlen(frags[i])) frags[i] = realloc(frags[i], strlen(frags[i+1])*sizeof(char)); ...

C array is displaying garbage data (memory problems?)

I'm making a driver for an 8x8 LED matrix that I'm driving from a computer's parallel port. It's meant to be a clock, inspired by a design I saw on Tokyoflash. Part of the driver is an array of 3*5 number "sprites" that are drawn to the matrix. A coordinate of the matrix is assigned to a coordinate of the sprite and so forth, until the...