c

GetOpenFileName() with OFN_ALLOWMULTISELECT flag set

Hello, I'm trying to use the GetOpenFileName() common dialog box call to pop open a dialog box and allow the user to select multiple files. I've got the OFN_ALLOWMULTISELECT flag set, as well as OFN_EXPLORER set so I get the "new style" file selection box. When I set up my OPENFILENAME structure, I have ofn.lpstrFile pointing to a buff...

Will Vala survive?

I'm just wondering how the Vala project is coming along. I'm not sure if this will be a great new technology or just one that will fall by the wayside. Does anyone know how many people are working on this project and if I can contribute (writing tutorials, reporting/fixing bugs, etc...)? ...

Determine UID that last modified a file in Linux?

I'm writing a program that will be monitoring select files and directories for changes. Some of the files are world writeable, some owner, some group. What I need to do is be able to figure out the last person to modify (not just access) a file. Somehow I thought this would be simple, given that we know the inode of the file .. however ...

Killing a "Critical Process" In Windows (C/C++)

What is the best way to kill a critical process? ...

libxml2 replacement

I was looking for a better (well documented and efficient) xml processing C library. ¿ Ideas ? ...

I am looking for a content addressing data structure

I'm trying to design a data structure that allows efficient extraction of entries from a part of their content. Let's say I am looking for an entry that matches this: [ x 2 3 x x ] If [ 0 2 3 4 5 ] or [ 3 2 3 7 8 ] are in my data structure, they should be returned by my find function. I wrote such a data structure where I compare the...

What's the difference between File stream in C and iostream in C++?

What's the difference between File (File* pointer)stream in C and iostream in C++? Why are they both called stream, do they have something in common? ...

Strange error while executing a C code in MSVC 2005

Hi, I am facing following quirky error. I have a workspace in MSVS2005 of all C code. I have declared a global variable in one C file.(file1.c) This file has function main() in which, I initilaize the value of that variable = 0.In other C file(file2.c). From main there is a function call to a function(func1 in file2.c) which sets the ...

After execvp returns, why doesn't my program pick up where it left off?

I have a block of code like this that runs as a child thread: if(someVar == 1){ doSomeStuff; _exit(0) } else execvp(*(temp->_arguments), temp->_arguments); printf("I'm done\n"); When I run the program with someVar == 1, I understand that the _exit(0) call kills my thread. However, when it's set to 0, why doesn't the program contin...

How can I call awk or sed from inside a c program?

How can I call awk or sed inside a c program? I know I could use exec(), but I don't want to deal with fork() and all that other nastiness. ...

When and why sleep() is needed ?

cout<<"abcd"; sleep(100); cout<<'\b'; If I want to print the string out and then get back one character , why a sleep() is needed here? But when using printf in C ,it seems that it is not necessary, why? char* a = "12345"; char* b = "67890"; threadA(){cout<<a;} threadB(){cout<<b;} beginthread (threadA); sleep(100); beginthread (th...

How can I use pointers to display strings in an array?

I am practicing using pointers. I have a pointer to an array of 3 strings: "dog", "cat", "rat". I can print the contents using a for loop and using an array. However, I am having problems printing them using pointer arithmetic. I would like to increment the pointer to the next element in the array. However, all it does is print the d...

Why is there a special new and delete for arrays?

What is wrong with using delete instead of delete[]? Is there something special happening under the covers for allocating and freeing arrays? Why would it be different from malloc and free? ...

Best way to serialize a C structure to be deserialized by Java, etc.

Currently, I'm saving and loading some data in C/C++ structs to files by using fread()/fwrite(). This works just fine when working within this one C app (I can recompile whenever the structure changes to update the sizeof() arguments to fread()/fwrite()), but how can I load this file in other programs without knowing in advance the sizeo...

char * function not displaying correctly in C

#include <time.h> #include <stdio.h> #include <stdlib.h> char *czas() { time_t rawtime; struct tm * timeinfo; char buffer [80]; time ( &rawtime ); timeinfo = localtime ( &rawtime ); strftime (buffer,80,"Now it's %I:%M%p.",timeinfo); return buffer; } int main() { printf("%s",czas()); system("PAUSE"); } I dont know why, b...

Derived classes in C - What is your favorite method?

In my experience in object oriented C programming I have seen two ways to implement derived classes. First Method, have a definition of the parent class as a .h file. Then each class that derives from this class will have do: File parent_class.h: int member1; int member2; File testing.c: struct parent_class { #include "parent...

Passing a function to another function in C. What am I doing wrong?

Got some c code I'm working on, and it looks like it should work. When I try to like the object files, I get an error saying "undefined reference to outputBus" and so on for each of them in the getLine function in main. I've tried it with and without the ampersand before the function names. compiling with "gcc -ansi. what am i doing wron...

how read all the server's responses from a socket?

hello, i have a very big problem... i'm working with sockets in C. i ask a question to the server which sends me many answers. the problem is that the client receive the first response and the the connection is closed. what can i do? i tried with setsockopt()... SO_KEEPALIVE or SO_LINGER but i haven't resolved the problem. Can you help ...

Call recv() on the same blocking socket from two threads

What happens if I have one socket, s, there is no data currently available on it, it is a blocking socket, and I call recv on it from two threads at once? Will one of the threads get the data? Will both get it? Will the 2nd call to recv return with an error? ...

Pointer vs array in C, non-trivial difference

I thought I really understood this, and re-reading the standard (ISO 9899:1990) just confirms my obviously wrong understanding, so now I ask here. The following program crashes: #include <stdio.h> #include <stddef.h> typedef struct { int array[3]; } type1_t; typedef struct { int *ptr; } type2_t; type1_t my_test = { {1, 2, 3}...