c

I want to learn about the programming in system software

Dealing semaphores and mutex, kernel and shell, which book shud i refer, as i am a beginner, i need to work with my basics as well. ...

snprintf vs strcpy(etc) in c

For doing string concatenation I've been doing basic strcpy,strncpy of char* buffers. Then I learned about the snprintf and friends. Should I stick with my strcpy,strcpy + \0 terminiation. Or should I just use snprintf in the future? thanks ...

Finding undefined symbols in windows static lib

Is there any way to find out the list of undefined symbols in windows static library compiled using VC6? I know the nm command will list all the symbols in linux and symbols with a tag of "U" can be identified as undefined. But, how to do it Windows? ...

C question on functions

some times i see that functions are defined as below: read_dir(dir) char *dir; { DIR * dirp; struct dirent *d; /* open directory */ dirp = opendir(dir); ......... so on here what is the importance of the statement char *dir; what is the intension behind declaring the pointer soon afte...

Where i can get the source code of string.h not function prototypes, but implementation of functions

Hi, This file String.h i found while searching about string.h. Where i can find functions implementation of functions defined in string.h i.e [say] source code of "void *memcpy(void *, const void *, size_t); " Also i want to ask how to make ur functions as an interface with its implmentation hidden from developer as string.h functio...

How to show a picture using GDI?

it is possible to display a picture on a window created by winmain i mean using GDI, i want do create a window that captures my whole screen i have done that by using GDI but unable to show an image on it how can i do so? ...

Can the size of a structure change after compiled?

Hi, suppose you have the following structure: #include <windows.h> // BOOL is here. #include <stdio.h> typedef struct { BOOL someBool; char someCharArray[100]; int someIntValue; BOOL moreBools, anotherOne, yetAgain; char someOthercharArray[23]; int otherInt; } Test; int main(void) { printf("Structure size: ...

AVL tree in C language

Hey all; i am currently doing a project that requires the use of AVL trees , the insert function i wrote for the avl does not seem to be working , it works for 3 or 4 nodes at maximum ; i would really appreciate your help The attempt is below Tree insert(Tree t,char name[80],int num) { if(t==NULL) { t = (Tree)malloc(sizeof(stru...

C question on casting

Can anybody explain me this statement! pin.sin_addr.s_addr = ((struct in_addr *)(hp->h_addr))->s_addr; ...

userspace to kernel space and sysfs and how to use sysfs to change one reservered value in igmpv3 pkt.

I have posted query previously and i am repeating same I want to modify igmpv3 (Linux) which is inbuilt in kernel2.6.-- such that it reads a value from a file and appropriately decides reserved(res 1) value inside the igmpv3 paket which is sent by a host. I want to add more to above question by saying that this is more a generic questio...

Why _PROTOTYPE is used header files.

Why do we use _PROTOTYPE e.g. _PROTOTYPE( void *memset, (void *_s, int _c, size_t _n) I saw it in MINIX3 source code ...

Redirecting the Standard Output/Input/Error into/from a textbox

I was making a VB.NET application that can be used to edit, compile and run C programs. I used the Process.StartInfo.RedirectStandardOutput property. But I'm unable to redirect it to a textbox, since it is not of the string type. How do I redirect the output coming from the cl.exe process to my textbox? ...

Setting exit status when creating core dump

For example calling exit(100) would exit the application with status 100, and calling raise(SIGABRT) aborts the application with status 134 while creating a core dump. But what if I want the core dump with status 100 or any other arbitrary value. How can I do that ? I know there are several signals that triggers a core dump, but they see...

Listing directories in Linux from C

I am trying to simulate linux command ls using linux api from c. Looking at the code it does make sense, but when I run it I get "stat error: No such file or directory". I have checked that opendir is working ok. I think the problem is in stat, which is returning -1 even though I think it should return 0. What am I missing? Thanks for...

Nested function in C

Can we have a nested function in C? What is the use of nested functions? If they exist in C does there implementation differes from compiler to compiler. Are nested functions allowed in any other language? If yes then what is there significance? ...

doubt in sizeof implementation

Below is the program to find the size of a structure without using sizeof operator: struct MyStruct { int i; int j; }; int main() { struct MyStruct *p=0; int size = ((char*)(p+1))-((char*)p); printf("\nSIZE : [%d]\nSIZE : [%d]\n", size); return 0; } My doubt is: Why is typecasting to char * required? If I don't use ...

Check which nodes of Beowulf HPC cluster system are free from PHP app?

I am working on my diploma thesis project. I have access to 32Node Dell poweredge HPC cluster system with Linux(Debian i think) installed on it. My first goal is to create web (PHP) app where logged users could see free and busy nodes, turn them on and off. I am planning to do something like this - write some cron daemon that would run e...

How do I return the indices of a multidimensional array element in C?

Say I have a 2D array of random boolean ones and zeroes called 'lattice', and I have a 1D array called 'list' which lists the addresses of all the zeroes in the 2D array. This is how the arrays are defined: define n 100 bool lattice[n][n]; bool *list[n*n]; After filling the lattice with ones and zeroes, I store the addresses of th...

mean and variance of image in single pass

hi everyone,am trying to calculate mean and variance using 3X3 window over image(hXw) in opencv...here is my code...is there any accuracy issues with this??or is there any other efficient method to do it in one pass.? int pi,a,b; for(i=1;i<h-1;i++) { for(j=1;j<w-1;j++) { int sq=0,sum=0; double mean=0; double...

how to find if stack increases upwards or downwards?

how to find if stack increases upwards or downwards? ...