c

Weird XPath behavior in libxml2

I have this XML tree that looks like this (I've changed the tag names but if you're really clever you may figure out what I'm actually doing.) <ListOfThings> <Thing foo:action="add"> <Bar>doStuff --slowly</Bar> <Index>1</Index> </Thing> <Thing foo:action="add"> <Bar>ping yourMother.net</Bar> <Index>2</In...

How can I print a NUL character without a space in C?

I have a situation where I have to print out a NUL character if there is no action in a part of my program. Take for example the code below: char x = '\0'; ... printf("@%c@\n", x); I want it to print this: @@ but it prints out @ @ Whats the correct way not to have the \0 character printed out a space as above? ...

#pragma init and #pragma fini using gcc compiler on linux

I would like to build some code which calls some code on loadup of the shared library. I thought i would do it like this: #pragma init(my_init) static void my_init () { //do-something } int add (int a,int b) { return a+b; } So when i build that code with gcc -fPIC -g -c -Wall tt.c It returns gcc -fPIC -g -c -Wall tt...

how to find out the page size of a processor using C program and malloc?

is it possible to find out the page size of a processor using C program and malloc? and not by using sysconf() call? ...

get file path from svn diff file with PHP and C

hi i have a file having svn diff i wish to extract the filenames form the diff. How to write the parser for that.. Index: libs/constant.php =================================================================== --- libs/constant.php (revision 1243) +++ libs/constant.php (revision 1244) @@ -26,5 +26,5 @@ // changesss - +// test 2 ?> \...

Attaching Member function of a class in pthread

pthread_t thread1; pthread_create(&thread1,NULL,.......,NULL); // Here I want to attach a thread to a member function of class How can I pass the member function of a class in the above code. ...

how to write a program in c

how to write a program that reads in a list of integers from a text file, print them out to another file in a formatted fashion? ...

* in password field in gcc

How to put * in the password field when user enter the password. Like in turbo we can use getch() but it is not available in gcc. Give me the other way ...

Runtime C function details

Hi, Is there any way to find particular C language function's input and output parameters from a framework (apple's ARM) during the runtime or from any method with out knowing the headers. It is a framework and there are no header files for it.I decompile it with IDA Pro and it gives me the function names but not input and output para...

how to bind a link local address to an ipv6 socket

This thread can be treated as a sister thread of previous one posted by me as well. It's will be very tedious that when you want to bind a link local adress to a ipv6 socket you need to the set sin6_scope_id field of sockaddr_in6 struct as well. I'm wondering if someone can provide a good practise like solution here for me or anyone who ...

Window interface instead of console in c.

I have console application in c. I want to convert into window application, kindly guide me so that I can make it possible. ...

problem with closing sockets

Hi, I'm trying to write a client/server program with threads. I close the socket once the connexion is finished. The servers gets plenty of new connexions, and the socket number (file descriptor) increases very quickly: after 5 minutes running I was already at around file descriptor number 800! Is this a normal thing? Do threads share...

OCI, an appetizer

Can anybody point me to a good OCI quick tutorial? I took a tour of official Oracle documentation, but it is really huge (and I know OCI deserves every line of it, anyway). Since I'm starting off with OCI I would like to have something more brief to play around with initially, and by which I can figure out how this interface works. A...

How can one get the value from SystemInformation::KeyboardSpeed (Windows API) in c code?

Is there a simple way? ...

Ansi c supports a ftp connection to transfer files from one pc to another?

i have a task to transfer text files from one pc to another using FTP , i need some directions how can it be done in ansi c as its user requirement to do it in ansi c windows palte form so windows libs may also be used .............. looking for help! ...

Can anybody explain how its printing output as "ink"

Hi I am new to pointers in C. I know the basic concepts. In the below code, why is it printing the "ink" as its output? #include<stdio.h> main() { static char *s[]={"black","white","pink","violet"}; char **ptr[]={s+3,s+2,s+1,s},***p; p=ptr; ++p; printf("%s",**p+1); } Thanks ...

Calling a standard library function in signal handler.

Why is calling a standard library function inside a signal handler discouraged? ...

Centering strings with printf()

By default, printf() seems to align strings to the right. printf("%10s %20s %20s\n", "col1", "col2", "col3"); /* col1 col2 col3 */ I can also align text to the left like this: printf("%-10s %-20s %-20s", "col1", "col2", "col3"); Is there a quick way to center text? Or do I have to write a funct...

Debugging instance of another thread altering my data

I have a huge global array of structures. Some regions of the array are tied to individual threads and those threads can modify their regions of the array without having to use critical sections. But there is one special region of the array which all threads may have access to. The code that accesses these parts of the array needs to car...

Why does this getchar() loop stop after one character has been entered?

#include <stdio.h> int main() { char read = ' '; while ((read = getchar()) != '\n') { putchar(read); } return 0; } My input is f (followed by an enter, of course). I expect getchar() to ask for input again, but instead the program is terminated. How come? How can I fix this? ...