c

stumbled in using ZwOpenFile.

I have to open a file using ZwOpenFile API. This is my requirement. When I set the path in object name parameter. I could see fields Length and maximumlength in the object name. Length is just length of the path and I usually keep maximumlength as the value of Length. It worked mostly, however some times it doesnot work. In some cases ...

where can i get the best e books for c/c++ ?

Possible Duplicates: List of freely available programming books Ansi C & C++ free e-book source for download Free C programming ebook for beginner students? i would like where i could get the best pdf's for c/c++ tutorial ...

Finding the max repeated element in an array

Given an array with N elements. We know that one of those elements repeats itself atleast N/2 times . We dont know anything about the other elements . They may repeat or may be unique . Is there a way to find out the element that repeats atleast N/2 times in a single pass or may be O(N) ... ??? P.S : No extra space is to be used . ...

Linked list problem

Hiii ... If we are given two linked lists (may be of different length) such that a few nodes from the end are common ... How do we find the first common node in least time as possible ... ? The lists are singly linked . Some nodes are common from the end and we need to find the first common one for both among them FROM THE END. ...

Make gdb quit automatically on successful termination?

I use a debugging script that runs several related processes in succession with the debugger. I'm currently using -x to execute several commands automatically (such as run). How can I make gdb quit automatically when the debugged process successfully terminates? Adding a quit command to the command file will cause that command to be hand...

2D array through pointers.

I want to scan a 2D array with the help of pointers and have written this code, could you tell me why the compiler gives errors? I know how to use double pointers to do the same, i was experimenting with this one. #include<stdio.h> #include<stdlib.h> int main(void) { int i,j,n,a,b; int (*(*p)[])[]; printf("\n\tEnter the size...

Non-block vs select() call in socket

I have to implement a game server in C which handles multiple clients and continuously exchange information with them. The client may not be sending information at all times.Should I assign a thread with non-blocking socket to them or use select() call. Which one is better? ...

Tools/techniques for diagnosing C app crash on Windows

I have written an application in C, which runs as a Windows service. Most users can run the app without any problems, but a significant minority experience crashes caused by an Access Violation, so I know I have a bug somewhere. I have tried setting up virtual machines to mirror the users' configurations as closely as possible, but canno...

Potential Problem in "Swapping values of two variables without using a third variable"

I recently came along this method for swapping the values of two variables without using a third variable. a^=b^=a^=b But when I tried the above code on different compilers, I got different results, some gave correct results, some didn't. Is anything terribly wrong with the code? ...

Undefined symbol

I'm getting an undefined symbol error even though I think I've defined it okay. From reading other posts and Googling, it seems that the linker is failing to find the appropriate symbol. I'm new to C so I'm sure I'm just missing something stupid. glen-urbans-macbook-pro:everybit glurban$ make gcc -O3 -DNDEBUG -std=c99 -Wall -Wstrict-p...

Memory allocation/reallocation question

I just finished working out a memory allocation problem with the current program I'm writing, but I am not happy with what I had to do to fix it. In my program, I was building up an array of structs, reallocating space for the array every time I wanted to add a struct to it. Here is a generic version of my struct and the function that ...

What would be the best way to wrap up this void pointer?

Alright, I have library I wrote in C that reads a file and provides access to its' data. The data is typed, so I'm using void pointer and a few accessor functions: typedef struct nbt_tag { nbt_type type; /* Type of the value */ char *name; /* tag name */ void *value; /* value to be casted to the corresponding type */ ...

Rotating an array of bits in C

I've just started learning C and I'm having some problems with some code I want to write. Basically I have this struct that is a bit array, with the number of bits in the array, and a pointer to a buffer of chars, that stores the bits. My strategy for rotating the bit array is simply taking the number of rotations (mod the length to a...

How do I run a function on each argument in a varargs list in C

I wish to Call mysql_real_escape on each argument of a vararg list before it is then passed on to vsprintf to include into an SQL string, is there anyway I can do this easilly? Seems I missed prepared statements, this seems to be usefull though anyway. ...

how to convert a utf8 string to ascii string ?

Possible Duplicate: UTF-8 -> ASCII in C language how to convert a utf8 string to ascii string ? ...

Preprocessor output

How do I view the output produced by the C pre-processor, prior to its conversion into an object file? I want to see what the MACRO definitions do to my code. ...

I'm getting a "conflicting types" error in C

I'm currently working on a program for a C course in which I have to output the area of a shape. Here is a function for a rectangle's area that I have in my program: double rectangle() // calculate area of rectangle { double length, width; printf("\nEnter length and width of rectangle: "); scanf("%g %g\n", &length, &width)...

HELP TCP Server in C cannot save in MYSQL !

I'm developing a TCP Server in C language that can save data to mysql. The problem is "buf" cannot be save/insert into mysql. But "name" can be save/insert into mysql. Do u know what is the problem is? and how to fix that? I'm very glad if u can help me. below is the code. to compile : gcc -o tcpecho $(mysql_config --cflags) tcpecho....

Parent process doesn't complete after child is terminated in C

I'm having trouble with a process forking exercise. I want to fork a child process and have it hang after announcing it has been forked, and wait for a signal to terminate, after which the parent process must announce it is terminating and then exit. I can get the processes forked and have the parent wait for the hanging child to be k...

Averaging 3 integers

My assignment is to fix the code. I have my edited code below and the original code below that. I figure I still have a few errors in here. My error checking doesnt seem to work, and I am not sure if my getchar() function is written or working properly. Please assume I know nothing becasue that is fairly accurate. The code compiles,...