c

expand an IPv6 address so I can print it to stdout

I am using getifaddrs() and inet_ntop() to get the ip addresses on the system. When the system is set to IPv6 the address returned is in the shortened version (using :: for zeros). Is there any way to expand that address to a full one? This is the code I am using: struct ifaddrs *myaddrs, *ifa; void *in_addr; char buf[64]; if(getifadd...

How worthwhile is it to read Richard Stevens' books?

I recently came across a good book by Richard Stevens, his "UNIX Network Programming, Volume 1, 2nd Edition" (in C), published 1998. I was reading it for the past week & realized while practicing some of the programs, that several methods used in it are not compliant to the standards or have a bit different approach. Also reproducing the...

Linked List in C

I am having some trouble running this linked list implementation (containing words as data). Problem is when I try to print the words (that I inserted) in the Linked List,I get nothing. What am I doing wrong, breaking my head over this? I hope it's not something silly. Anyway here's the code - typedef struct node { void *data; s...

Compiling NCURSES src on HPUX

I am trying to compile ncurses-5.7 from source and after running ./configure I get the following error: configure: error: Your compiler does not appear to recognize prototypes. You have the following choices: a. adjust your compiler options b. get an up-to-date compiler c. use a wrapper such as unproto how can...

Any compiler which takes 'char' as 'unsigned' ?

hi, Is there any C compiler which takes the default type of char as unsigned unless explicitly mentioned by the user in the file or project settings? /Kanu_ ...

Character arrays, and pointers how to use strtok and strcmp.

I'm writing a linux shell for my operating systems class. I've knocked out the majority of it but I'm stuck on simple string comparisons. I've everything I can think of. strcmp should take in \0 terminated strings and return 0 for equal but that doesn't seem to be working and even stepping through the array and checking each char isn'...

What is the best way to close this group of processes?

I have the following group of processes, which need to be closed programmatically by the first listed process, which is a C program that I am coding. PID PGRP SESN PPID USER TTY CMD 6553 6553 6553 1 root ? ./startserv 6554 6553 6553 6553 root ? expect -- /usr/bin/unbuffer ./srcds_run... 6555 655...

Debugging a multi-thread programe with "Disassembly view" in visual studio

When I continuously do "step into",it switches between different threads. But how's that scheduled in visual studio,how does it know which thread to activate for next instruction? ...

How do I call C functions from Flash?

Currently I have a UNIX executable that I am compiling from xcode. It runs in terminal. (osx) I'm wondering if there is a way to call functions / interact with a flash or flex project. I found some information about a flex c++ bridge, but apparently it is only for windows. Can this be done with air? Any suggestion? ...

How can I present live audio data (updating buffer) as an audio file in C

Hi I am recieving live audio as floating points in an updating array. I want this live data to present as a file that can b read by vlc media player. Can someone guide me how can I do that in C language? /mudassar ...

How are thread names populated in thread window of visual studio?

Especially,how the thread be named by method name like GrabberCB::BufferCB? ...

When is "extern C " necessary in c++ in windows?

As we know that we can use c functions directly in c++, when is extern "C" necessary then? ...

Sorting an Array of strings with capital and lowercase letters in C

Is there a way to sort an array of strings in alphabetical order where the strings contain both capital and lowercase letters? Because capital letters have a lower ASCII value so functions like strcmp would always show that it is before a lower case letter. For example, lets say we wanted to sort "ABCD", "ZZZZ", "turtle", "JAVA", "wate...

Generic editable functions in C using void*

Hi folks, I fall in some problem. I need to write some function like memcpy(void*, const void*), which its signature should be: void arrayCopy(void *dest, int dIndex, const void *src, int sIndex, int len) I noticed that, in many implementation of memcpy, we cast void* to char*, but I think this is not the case of me, as the arrayCop...

Problem in memcpy using non-char data as parameters!

Hi guyz, The following program doesn't output desired data (on VC2008 compiler) #include <stdio.h> #include <string.h> int main(void) { int i; int dest[10] = {1}; int src [] = {2, 3, 4, 5, 6}; memcpy(dest, src, 5); for (i=0; i<10; i++) printf("%i\n", dest[i]); return 0; } whereas using char arrays instead, ...

What does this C code do?

I'm really new to C programming, although I have done quite a bit of other types of programming. I was wondering if someone could explain to me why this program outputs 10. #include <stdio.h> #include <sys/types.h> #include <unistd.h> #include <sys/wait.h> #include <stdlib.h> int value = 10; int main() { pid_t pid; pid = for...

How to detect cold boot versus warm boot on an ARM processor?

I'm looking for a way to determine whether an ARM processor is booting from a cold boot (i.e. initial power-on) versus a warm boot (i.e. reset assertion without actual power loss). Specifically I'm using an ARM968 core, will be making the determination using C or assembly, and I will use the determination so certain operations only run ...

Arrays of strings in C

I need to hold an array of C strings. Now I know C strings are just an array of chars so essentially what I want is a 2d array of chars. The strings I'm trying to store will also never exceed 6 characters. My plan is to initialize a char array with 50 "string slots" and then if I hit 50 strings reallocate the array's memory to double it'...

How can I use C++ enum types like C# ?

How can I use C++ enum types like C# ? consider following definition in c++ : enum myEnum { A, B, C}; myEnum en = A; Now I want write line #2 as following line like C# : myEnum en = myEnum.A; ?? ...

Which is Beneficial: Calling C code from C# or Converting C code into C#

I want to know which is beneficial in terms of performance and execution time: calling C code from C# or converting C code into C# code. Note: My C code uses Linear Algebra Library. ...