c

debugging a makefile

I have a makefile which has statements like below: TOPICS = dmic SRV_MODE = ifeq "$(SRV_FLAG)" "ON" SRV_MODE = 2 endif vpath d%_srv.h $(CNT_PATH) USER_PRE_TARGETS := $(foreach topic,$(TOPICS),$(topic)_srv.h) dmic_srcs = $(wildcard $(CCWSCA)/dmic/src/*.c) \ $(wildcard $(CCWSCA)/dmic/src/*.ppc) dmic_srv.h: $(dm...

nearest neighbor mapping of 1D index for 2D array into a smaller 2D array

This is in C. I have two 2D arrays, ArrayA and ArrayB, that sample the same space. B samples a different attribute than ArrayA less frequently than ArrayA, so it is smaller than A. Just to try to define some variables: ArrayA: SizeAX by SizeAY, indexed by indexA for a position posAX, posAY ArrayB: SizeBX by SizeAY, indexed by indexB...

Undefined/unspecified ?

Possible Duplicate: Why is i = ++i + 1 unspecified behavior? Consider the following snippet : int i=10; printf("%d %d %d",i,++i,i--); The order in which the arguments to a function are evaluated is unspecified in C/C++.So it lead to unspecified behavior. Am I correct or missing something ? Please Explain. EDIT:Well,some me...

Avoiding TIME_WAIT

I'm trying to avoid TIME_WAIT in a client. I connect and then set O_NONBLOCK and SO_REUSEADDR. I call read until it returns 0. When read returns 0, the errno is also 0. I interpreted this as a sign that the server closed the connection. However, if I call close, the socket is set to TIME_WAIT, as confirmed by netstat. Since I make ...

expected specific-qualifier-list before 'function' and expected '=', ',', ';', 'asm' or '__attribute__' before 'function'

Hello, I am programming in Objective-C but I would like to write a c function to increase the performance. I have written the code below this post but the compile keeps coming back with the following error: error: expected specific-qualifier-list before 'bool' error: expected '=', ',', ';', 'asm' or 'attribute' before 'addToBo...

C select() writefds

I am having trouble understanding what it means to add a descriptor to writefds set for select() in linux. I wrote some simple code that adds the descriptor for stdout to the writefds set and uses a timeout of NULL. Now, my code just infinite loops checking if this descriptor is set, and if it does, it prints "WRITING". When I run my cod...

Why doesn't scanf need an ampersand for strings and also works fine in printf (in C)?

I am learning about strings in C now. How come to use scanf to get a string you can do scanf("%s",str1); and for printf you can do printf("The string is %s\n", str1); I understand that for scanf it is because the string is just a character array which is a pointer, but for printf, how is it that you can just put the variable name...

How to map XML schemas to C/C++ code?

What the best way to map XML schemas to C/C++? Here is an example: ------ C/C++ ----- struct zone { char *var_name; float var_value; }; ------ XML ----- <xs:element name="zone"> <xs:complexType> <xs:sequence> <xs:element name="Var_name" type="xs:string"/> <xs:element name=...

How do I generate a fixed-waveform table in C?

What is the most efficient way to generate a signed float array of arbitrary length containing the amplitude (represented from 1 to -1) of a sine wave in C? ...

how to pass xml schema through sockets ?

Hi Could someone please help and tell me if there is a possibility to pass an xml schema through a socket program written in C/C++ ? here is an example: ---- c/C++ ---- ... struct zone { // as an example char *Var_name="xxx"; float var_value = 1.3; }; ----- xml --- ... <xs:element name="zone"> <xs:complexType> <xs:sequence>...

create symbol table

Hi all , Is there any body who can tell how to create symbol table for compiler using C. ...

How to design a C / C++ library to be usable in many client languages?

I'm planning to code a library that should be usable by a large number of people in on a wide spectrum of platforms. What do I have to consider to design it right? To make this questions more specific, there are four "subquestions" at the end. Choice of language Considering all the known requirements and details, I concluded that a lib...

c segmentation fault structure

I have a structure called table, I just want to create a table, like constructor in java, but when i call this function in main, it gives segmentation fault struct table *create(char *name,int number,char *s_name) { struct table *newTable; newTable->name = name; newTable->number = number; newTable->s_name = s_name; return newT...

How to change to an external disk drive in C

Hi all I was wondering how (if possible) to change to an external HDD in C. I am writing a program that works with an external HDD. Thanks much, Mr. Man ...

Accessing main program global variables from a dlopen()ed dynamic library in C on OS X

I am maintaining a small application that has some plugin-like functionality, which is implemented through runtime-loaded dynamic modules. Specifically, since it's a Gtk+ app, I'm using gmodule, but the question applies to dlfcn.h / dlopen() based dynamic library loading just as well. My main program has a single, global struct variab...

What's a portable way of converting Byte-Order of strings in C

I am trying to write server that will communicate with any standard client that can make socket connections (e.g. telnet client) It started out as an echo server, which of course did not need to worry about network byte ordering. I am familiar with ntohs, ntohl, htons, htonl functions. These would be great by themselves if I were trans...

Python, Threads, the GIL, and C++

Is there some way to make boost::python control the Python GIL for every interaction with python? I am writing a project with boost::python. I am trying to write a C++ wrapper for an external library, and control the C++ library with python scripts. I cannot change the external library, only my wrapper program. (I am writing a functi...

word alignment of 4 byte for XOR operations

Is there any advantage in doing bitwise operations on word boundaries? Any CPU or memory optimization in doing so? Actual problem: I am trying to create XOR of two structure. Lets say structure-1 and structure-2 both of same size 10000 bytes. I leave first few hundreds bytes as it is and then start XOR of 1 and 2. Lets say I start with...

What is the difference between POSIX sockets and BSD sockets?

Could someone please explain the differences between POSIX sockets and BSD sockets? ...

maximal value in recursion

Hi, I have this homework assignment: Let Pi be the element of arr in index i. We say an index i is ‘well-placed’ if there exists an index j (j >= i) so that summing the elements in Pi Pi+1 … Pj yields the index i. In other words, an index is ‘well-placed’ if a sequence of elements beginning at that index yields the index when summed....