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? ...
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? ...
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 ...
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. ...
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...
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 ...
Does anyone know of an open-source implementation of a partial least squares algorithm in C or C++? ...
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 ...
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...
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) { ...
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. ...
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.. ...
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.. ...
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* ...
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...
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...
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 ...
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...
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...
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)); ...
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...