c

How to upload image in particular directory using CFFTP

I need to upload an image, for this i am using API's of CFFTP. But when I successfully login I am in path(/home/ftpadmim). But I want to upload image on some other path, so I need to change directory and go to root directory and then move to specified directory. But the problem is that I did not find any API of CFFTP that work same. I...

What is an efficient workflow with C? - Makefile + bash script

I'm working on one of my first projects that will span more than one C file. For my first couple practice programs, I just wrote my code in main.c and compiled using gcc main.c -o main. This worked for me as I was learning. Now, I'm working on a much bigger project on my own. I want to continue doing compilation on my own (or at least s...

Blocking recv doesn't exit when closing socket from another thread?

In Linux if we call blocking recv from one thread and close for the same socket from another thread, recv doesn't exit. Why? ...

C2061 Syntax Error (identifier)

1>cb.c(51): error C2061: syntax error : identifier 'SaveConfiguration' 1>cb.c(51): error C2059: syntax error : ';' 1>cb.c(51): error C2059: syntax error : 'type' 1>cb.c(52): error C2061: syntax error : identifier 'LoadConfiguration' 1>cb.c(52): error C2059: syntax error : ';' 1>cb.c(52): error C2059: syntax error : 'type' 1>cb.c(122): er...

help with setitimer / signal issue

I have the following code which I'd hope would wait 2 seconds then wait 5 seconds in a loop. There is a reason why I'm not using the it_interval to refire the timer. #include <stdio.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <signal.h> #include <time.h> #include <sys/time.h> #include <semaphore.h> sem_t se...

Time Delay (Linux)/(Windows)

I have written a source code with a time delay.In unix I have used the #include <unistd.h> header file and usleep function. What is the equivalent to this on windows? What library and function should I use if I write the same code on windows. ...

Difference between "while" loop and "do while" loop

What is the difference between while loop and do while loop. I used to think both are completely same.Then I came across following piece of code : do { printf("Word length... "); scanf("%d", &wdlen); } while(wdlen<2); This code works perfectly. It prints word length and tascans the input. But when I changed it to ...

extracting a structure from a nested structure in c

Hi I have following problem: I have one global structure that has many structures inside. Now I want one of the substructures taken out and stored in some other structure. typedef struct { int a; }A; typedef struct { int b; }B; typedef struct { A dummy1; B dummy2; } C; I want to declare fourth structure that extracts A fr...

Is there such a thing as a union of unions?

I came across the following code - what is the data type of col_8888 and why does it reference the union _colours? I googled unions, but I can't find a reference to this kind of declaration - it looks to me as though col_8888 is a "union of unions"? union _colours { uint8 c[3][4]; uint32 alignment; }; static const union _colou...

MultithreadingMultiprocessing with STOP and Continue Signals

Hello ALL, I am working on a project, where i need to get native stack of the Java Application. i am able to achieve this partially. thanks to ptrace/multiprocessing and signals. on Linux normal java application has minimum 14 number of threads. out of these 14 i am interested in only main thread of which i have to get native stack. co...

Can 'return' return multiple values in C?

Possible Duplicate: C++ return x,y; What is the point? Here's a piece of code that executes perfectly in C. int a=3,b=4,x,y; x=a+b; y=a*b; return(x,y); This function returns 12. Can someone please explain. ...

Are there any open source C Library (not c++) for Windows Driver Development ?

Are there any open source C Library (not c++) for Windows Driver Development ? I am developing a network device driver that need some functionality such as RegEx, string manipulation, Object Oriented by C and XML and so on... thanks. ...

Why does this C program print weird characters in output?

Dear all, I've the following program: #include <stdio.h> int main() { int ch; while( ch = getchar() != '\n') { printf("Read %c\n",ch); } return 0; } No matter what I enter I get: Read Why is this happening and what is that weird char that I see? Stackoverflow is not printing th...

Allocate space for struct pointer in subfunction

How can I allocate memory for a struct pointer and assign value to it's member in a subfunction? The following code will compile but not execute: #include <stdio.h> #include <stdlib.h> #include <string.h> struct _struct {char *str;}; void allocate_and_initialize(struct _struct *s) { s = calloc(sizeof(struct _struct), 1); s->st...

If characters can hold what integers can then why is there a need to use integers?

Why do we at all use integers in C? #include<stdio.h> int main() { char c=10; printf("%d",c); return 0; } Is same as: #include<stdio.h> int main() { int c=10; printf("%d",c); return 0; } ...

determine if regular expression only matches fixed-length strings

Hi, Is there a way of determining if the regular expression only matches fixed-length strings ? My idea would be to scan for *,+ and ? Then, some intelligent logic would be required to to look for {m,n} where m!=n. It is not necessary to take the | operator into account. Small example: ^\d{4} is fixed-length; ^\d{4,5} or ^\d+ are variab...

Cannot create a program which will invert string

I am using Linux. I am trying to write a program in c that will print a string backward. Here is my code: #include <stdio.h> #include <string.h> #include <stdlib.h> int main (){ char string[100]; printf ("Enter string:\n"); gets (string); int length = strlen (string)-1; for (length = length; length>=0; length--){ ...

Problem with makefile

hiii , i just started studying makefiles and wrote the following one for a simple hello.c file. it shows some error saying : makefile1:5: * missing separator. Stop. What is the wrong here ... ? CC=gcc CFLAGS=-c -Wall hello: hello.c $(CC) $(CFLAGS) hello.c -o hello clean: rm -rf *.o And , Is it always a ...

Porting a shared memory JNI app from Linux to Windows for use with NTP

I have a small JNI program that uses shared memory to update NTP on a Linux server. The C portion of the code has three functions: attach the shared memory, set the time stored in the shared memory, and detach the shared memory. I would like to be able to run this program in Windows, while keeping the C code at least somewhat portable....

Where can I find an efficient R-Tree implementation?

I'm looking for an R-Tree implementation, in C, Objective-c and even C++, which shall be efficient for searching the 2d rectangle in which a point falls ( memory efficiency would also be great, but I can sacrifice a bit more memory for time even while I am on an iPhone ). A good documentation will be appreciated too ...