c

Disabling stdout buffering of a forked process

Hi, I wrote a code in C/C++ which forks a child process, duplicates the stdin/stdout into a pipe ends and calls execvp. Everything is working fine (i.e. the output from stdin/err/out is captured by the parent process) The problem is that the child stdout is buffered. so if the child code looks like this: printf("Enter any key and hi...

How to convert plain text to ODF?

Hi everybody! I am searching for C/C++ library for txt -> odf conversion. I've already checked http://odftoolkit.org but it has only Java version. Main criterion is a ease of use. ...

What C/C++ library to use for HTML DOM building/changing?

I am using perl module HTML::DOM (link to CPAN) for building HTML DOM tree from HTML code and then changing it using standard DOM's removeAttribute, removeChild, innerHTML, createElement and so on. But, I have found out it's really, really slow and eating too much memory (it's fully in perl, anyway). So, I thought that there will be som...

can anyone give me a step by step guide to implementing QOS aware AODV protocol in NS2??

I am new to NS2. I need to know how the QOS parameters are added in NS2 filesysytem. Thnk You in advance ...

Can I determine how much valid memory is addressed by a char * argument?

I have a function like: // string is a null-terminated char array. Replace all a in the string with b void ReplaceCharInString(char *string, char a, char b) { // loop over the string char by char, to find all "a"s and replace them with "b" } I'm doing the defensive programming. The problem is the implementation replies on the client t...

What does EAGAIN mean?

As in the title what does EAGAIN mean? ...

Help in Pascals triangle

The following code snippet prints the Pascals triangle,I have got this snippet from the internet but I am unable to get the formula for bin.If anyone can help me out with it I would be thankfull\ #include<stdio.h> int main() { int bin=1,p,q=0,r,x; clrscr(); printf("Rows you want to input:"); scanf("%d",&r); printf("\...

Moving from C++ to C

After a few years coding in C++, I was recently offered a job coding in C, in the embedded field. Putting aside the question of whether it's right or wrong to dismiss C++ in the embedded field, there are some features/idioms in C++ I would miss a lot. Just to name a few: Generic, type-safe data structures (using templates). RAII. Espe...

Memory Segments of a Program in C

I'm looking for a tutorial describing about the various memory segments of a C program like code segment, data segment etc and what type of information is stored into them (i.e. where global, static, automatic etc variables are stored and why?). --Ravi ...

Does prstat SIZE value in Solaris increase indicate memory leak?

In my program, I create 100 threads, then wait for all of them to join and then repeat this operation again. In each of the threads, I create some memory and free it. I am fairly sure, all the memory which I am creating in those threads are getting freed. But, the SIZE output and RSS output of prstat are continously increasing. They ar...

Transfer a file/directory from local computer to remote computer via SSH in C?

I have my local computer and I also have a remote computer. I want to make a C program that moves a file or folder to that remote computer. How can I do this in C? Or is this only possible though Terminal commands? ...

Terminating scanf programically in C language.

Well, I'm programming using C language on a Linux OS. I'm writing a program that scans an input from the user. However, I want the scanf to have a certain time limit. For example, if the user does not enter anything on the keyboard withing 10 seconds, it will skip the scanf and go to the next line. I'm using alarm(10) to wait for 10 seco...

Simple update mechanism for C/GTK app on Windows

Hi, I am developping a C/GTK application. I will soon be releasing a new version, and I thought it would be useful to include some update mechanism to it so that the application will be able to update itself. I really only need something simple; it is sufficient if it only worked on Windows, since on Linux the application is in the rep...

What is a contiguous memory block?

Just like in the title, what is a contiguous memory block? ...

Interface a microcontroller and a printer .. code it in C programming.

Hi friends.. Guide me how to program in "C" to interface a microcontroller with a printer.?? Also explain me the procedure of how actually printing is related to a micro controller.?? ...

How do I use two pipes in Unix C?

I have a homework to do that says the following: Write a program in C that creates a child who will also create a child, make a pipe between the three processes, the fist process(father) will connect the second(child) and the child will connect with the third (child of the child). Our program should display the total number of system u...

Convert ISO-8859-1 strings to UTF-8 in C/C++

You would think this would be readily available, but I'm having a hard time finding a simple library function that will convert a C or C++ string from ISO-8859-1 coding to UTF-8. I'm reading data that is in 8-bit ISO-8859-1 encoding, but need to convert it to a UTF-8 string for use in an SQLite database and eventually an Android app. I ...

CUDA Matrix multiplication breaks for large matrices

I have the following matrix multiplication code, implemented using CUDA 3.2 and VS 2008. I am running on Windows server 2008 r2 enterprise. I am running a Nvidia GTX 480. The following code works fine with values of "Width" (Matrix width) up to about 2500 or so. int size = Width*Width*sizeof(float); float* Md, *Nd, *Pd; cudaError_t err ...

get first day of given week

I have the current week as an integer (43 as of now). I need the date for Monday in a format like 'Mon Oct 25'. Thought I could accomplish that by a function from but I don't know how to do that. Any suggestions? EDIT: I tried the suggestion from R., but it doesn't give the expected result. Did I implement it wrong? time_t monday; ch...

Unix C program issue using pipes and processes

Here's the story: Write a program in C that creates a child process and a granchild process (child of a child process!). The father process should read the contents of a file which name will take as an argument when you run the program. The father should send the text read to the child, which takes to convert those characters 'a' found ...