c

Receiving UDP packets in C

I have been trying to do this in ms visual studio 2008 using the winsock2 package but whenever i try to resolve the input ip address, which is valid, I get an "Invalid ip..." error. My only guess is that there is some permissions error, but I really have no clue whats wrong. Please help! if(WSAStartup(MAKEWORD(2,2), &wsaData) != 0){ ...

Accented/umlauted characters in C?

I'm just learning about C and got an assignment where we have to translate plain text into morse code and back. (I am mostly familiar with Java so bear with me on the terms I use). To do this, I have an array with the strings for all letters. char *letters[] = { ".- ", "-... ", "-.-. ", "-.. ", ".", "..-." etc I wrote a function for ...

Pointer in struct question. Have I done it correct?

Hi, I am rewriting some code from having a regular pointer to where the pointer is in a struct. This is the original code which works: int wrote = sf_writef_double(outfile, *mono_channel, frames); In the new code, where I have put the mono_channel pointer in a struct have I written int wrote = sf_writef_double(outfile, data->mono_c...

thread termination issue (c programming)

I'm working on an application for Linux in C which uses multiple threads. The threads which are spawned by the main function do most of the work, and therefore usually finish last. I'm seeing some strange behavior, and I believe it's due to the main thread terminating before the spawned threads have a chance to finish their jobs. Here's ...

uint8_t vs unsigned char

What is the advantage of using uint8_t over unsigned char in C? I know that on almost every system uint8_t is just a typedef for unsigned char, so why use it? ...

Generating a 160bit string which is stored in an array.

Hello! I'm trying to generate a random 160bit string which is supposed to be stored in a character array named str[20]. It's obvious that the array holds 20 characters. How can I change the 160bits into 20 characters/numbers? I'm trying to do this in C.. Any help is greatly appreciated as I've ran out of ideas and then helpdesk at my uni...

Strip first and last character from C string

I have a C string that looks like "Nmy stringP", where N and P can be any character. How can I edit it into "my string" in C? ...

Removing Spaces from a String in C?

What is the easiest and most efficient way to remove spaces from a string in C? Thanks. ...

Problem with processing individual strings stored in an array of pointers to multiple strings in C

An array of pointers to strings is provided as the input. The task is to reverse each string stored in the input array of pointers. I've made a function called reverseString() which reverses the string passed to it. This functions works correctly as far as i know. The strings stored/referenced in the input array of pointers are sent on...

Why can't compiler derive string length for array of strings?

Note: This question was influenced by this answer. The following is valid C code: char myString[] = "This is my string"; This will allocate a string of length 18 (including the \0 character) on the stack and assign the specified value to it. However, the following: char myStrings[][] = {"My 1st string", "My 2nd string", "My 3rd str...

Distributed system design using only C

Hi, I have the work of implementing a distributed system of nodes (like p2p nodes) each of these nodes (lets say A,B,C and D) perform certain functions and need to interact with each other for various operations such as synchronize operations and other things like 15 A nodes interact with a group of 5 B nodes to get into the least loade...

I'm trying to split a string by a delimiter but it doesn't work, why?

Hi All, I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago\n and then split each line by ';' delimiter and print each record. But for some reason the "record" pointer comes back always null. Why? char del = ';'; char input[BUFLEN]; while(fgets(input, BUFLEN, fp)) { ...

What are the possible ways to exchange data in binary format between windows and solaris?

Hi Everyone, Could someone please help and tell me if there is any possible way to pass a data structure (i.e. binary format) through internet sockets between a program running on Windows and other program running on Unix? Any idea or link to materials that deal with it would be very appreciated. Thanking you in advance for your help, ...

Trying to split by two delimiters and it doesn't work - C

Hi All, I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago\n and then split each line by ';' delimiter and print each record. Then in yet another loop I try to split the record by '=' delimiter to get to the actual values. But for some reason then the main (first) loop doesn't loop beyond ...

Tips for debugging a made-for-linux application on windows?

I'm trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I'm having trouble finding the spot in the disassembly where the issue is. I have tried three different debuggers (WinDbg, OllyDbg, and VisualStudio) and each pretty much gives me th...

Open source C/C++ 3d renderer (with support of 3ds max models)

Best, smallest, fastest, open source, C/C++ 3d renderer (with support of 3ds max models), better not GPL, It should support Lights, textures (better dynamic), simple objects, It should be really fast and it shall have lots of use examples ...

Fastest method for running a binary search on a file in C?

For example, let's say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste of time to copy the entire file into an array and then run binary search...I've effectively made it a linear time algorithm, because I'll ha...

Linux datetime/locale library in C

I need a tiny standalone library in C on linux platform that will return "Friday" when provided with (2009, 11, 13) for example. I would like it to be locale aware, meaning, returning day and month names in language set by the user. Any suggestions? ...

How do I get hardware information on Linux/Unix?

How I can get hardware information from a Linux / Unix machine. Is there a set of APIs? I am trying to get information like: OS name. OS version. available network adapters. information on network adapters. all the installed software. I am looking for an application which collects this information and show it in a nice format. I ha...

Just Curious about Python+Numpy to Realtime Gesture Recognition

i 'm just finish labs meeting with my advisor, previous code is written in matlab and it run offline mode not realtime mode, so i decide to convert to python+numpy (in offline version) but after labs meeting, my advisor raise issue about speed of realtime recognition, so i have doubt about speed of python+numpy to do this project. or bet...