c

Why does my Berkeley DB concurrent data store application hang?

My application hangs when trying to open a concurrent data store (CDB) database for reading: #0 0x0000003ad860b309 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0 #1 0x00007ffff7ce67de in __db_pthread_mutex_lock (env=0x610960, mutex=100) at /home/steve/ldm/package/src/Berkeley-DB/dist/../mutex/mut_pthread.c:318...

How does C compute sin() and other math functions?

I've been poring through .NET disassemblies and the GCC source code, but can't seem to find anywhere the actual implementation of sin() and other math functions... they always seem to be referencing something else. Can anyone help me find them? I feel like it's unlikely that ALL hardware that C will run on supports trig functions in ha...

Restrict application to one instance per shell session on Windows

There are a lot of solutions for restricting an application from running twice. Searching by process name, using a named mutex etc. But I all of these methods don't work if I want to restrict my application to the shell session. A user may have more than login session and shell on windows (right?)? If this is true I want to be able to r...

Approved syntax for raw pointer manipulation

I am making a memory block copy routine and need to deal with blocks of raw memory in efficient chunks. My question is not about the specialized copy routine I'm making, but in how to correctly examine raw pointer alignment in C. I have a raw pointer of memory, let's say it's already cast as a non-null char *. In my architecture, I can ...

I can't seem to delete the simplest case on a Binary Search Tree in C

Hi, I've posted about this last year because some university project and now I have to do it again (I never finished what I had to do last year). I've already looked at me previous code, all you guys answers on those questions, but still, I can't seem to understand this. I'm not going to put all my questions in one long post, it just m...

Please Help to make asynchronous socket server and client working ( written in C)

Hi, Could some please help me with these codes? I am trying to make client and server to communicate asynchronously. I mean both client and server don't wait for each other (e.g. when a server or client reads from recvfrom() and data are not present, it takes the last received one (what I named is backup). Here are the codes: client ...

Writing to a character array that is a member of a struct

Hello, this is my first time posting a question here - I've searched for ones that are similar, but none came up that I found. Here is the snippet from my header: #define LINE_LEN_MAX 256 typedef struct line_description { char buffer[LINE_LEN_MAX + 1]; [...] } line; And here is the snippet from my main function: int main(in...

Calling SQL Server stored procedures via ODBC fails, leaving empty tables

We are using ODBC from C on Linux. We can successfully execute direct statements ("INSERT ...", "SELECT ...", etc) using ODBC for both SQL Server 2008 and MySQL. We are migrating to stored procedures, so we first developed MySQL stored procedures. Calling MySQL stored procedures using ODBC works. Life is good. The stored procedures are ...

Why am I getting a segmentation fault with this code?

What ever could be the problem with it? #include <stdio.h> #include <string.h> #define SIZE 19 void filePrint(char fileName[]); int main (void) { char fileRead[SIZE]; filePrint(fileRead); return 0; } void filePrint(char fileName[]) { FILE *inp; int input_status = 0; char readFile[SIZE]; inp = fopen(fileName, "...

How to output to a file with information from a pipe in C?

I'm confused about what I'm doing wrong when I'm attempting to output to a file after I've execed a second program. Say I have input file that has the following names: Marty B. Beach 7 8 zachary b. Whitaker 12 23 Ivan sanchez 02 15 Jim Toolonganame 9 03 After my programs finish, it will convert the student's names to their...

c makefile rcv ranlib

Hi, How to write make file in c. what is advantage of using rcv & ranlib attribute. Please describe it. LIBTARGET= myfile.a $(LIBTARGET): $(LIBOBJS) $(AR) rcv $(LIBTARGET) $? ranlib $(LIBTARGET) Can any body describe why we use rcv & ranlib. thanks in advance. ...

How to use printf in C and what should my code be printing out?

I am new to C and I am trying to figure out what the printf method does. I have this little bit of code and I keep getting errors when I use the %x for example printf(“a) %x\n”, px); x% is for hex, Am i just using the wrong type here or is something else going on? what should the code I have below be printing out? int x = 10; int y = 2...

Trailing slash important, but stripped out?

If I create a url a la: const UInt8 *pFilepath = (const UInt8 *)[[NSHomeDirectory() stringByAppendingString:@"/Documents/"] UTF8String]; CFURLRef ldestination = CFURLCreateFromFileSystemRepresentation (NULL, pFilepath, strlen((const char*)pFilepath), false); and then log it to see what I've got a la: NSLog(@"destination url:%@",(NSSt...

Local Variable or Static Variable or Global Variable

In recursive function, the variable should be declared as local or static or global variable? Thanks in advance... ...

get error instead of incompatible pointer type warning

Hi, In a C program I get "passing argument ... from incompatible pointer type" warnings, however I want to get error and terminate compilation instead of warning. What flag shall I set in makefile? ...

Crypt type identification /etc/shadow

I know that the password field in /etc/shadow is prefixed with ${number}$ if it is not simply DES encrypted. What I am not able to find is a table that correlates the type of encryption to a given number. For instance, $1$ would indicate MD5. Its the rest that escape me (i.e. SHA1, SHA256, Twofish, Blowfish, etc) I've gone through the ...

The behavior of a C compiler with old-styled functions without prototypes

When my program consists of two files: main.c #include <stdio.h> int main(void) { printf("%lf\n",f()); return 0; } func.c double f(int a) { return 1; } compiler do not show any errors. When my program consists of only one file: main.c #include <stdio.h> int main(void) { printf("%lf\n",f()); retur...

what does "static" mean in C

Possible Duplicates: What does static mean in a C program? Static vs global Can someone help me understand what does "static" mean in C, giving the following example: " "static struct ........" and what is the diffrence between this and "struct ......" without the "static" ...

setting up netbeans for c

i am really getting annoyed all i want to do is setup a compiler for c in netbeans - i donwloaded and followed the instructions for MiniGW, and now whenever i try to comnpile a programme it says ""Resolve missing native build tools" and the make command and debugger command fields are empty - can anyone help if not can someone tell ...

Winpcap MinGW compile error

I'm experimenting with WinPcap 4.1.1 libraries for Windows, but I can't manage to compile even example source provided with the library. I'm getting these errors: 'PCAP_OPENFLAG_PROMISCUOUS' undeclared (first use in this function) 'PCAP_SRC_IF_STRING' undeclared (first use in this function) And bunch of warnings: implicit d...