c

What is the argument for printf that formats a long?

The printf function takes an argument type, such as %d or %i for a signed int. However, I don't see anything for a long value. ...

cross platform unicode support

I find that getting Unicode support in my cross-platform apps a real pain in the butt. I need strings that can go from C code, to a database, to a Java application and into a Perl module. Each of these use a different Unicode encodings (UTF8, UTF16) or some other code page. The biggest thing that I need is a cross-platform way of doin...

Calling DLL functions from VB6.

I've got a Windows DLL that I wrote, written in C/C++ (all exported functions are 'C'). The DLL works fine for me in VC++. I've given the DLL to another company who do all their development in VB. They seem to be having a problem linking to the functions. I haven't used VB in ten years and I don't even have it installed. What could be th...

How to get intellisense to reliably work in Visual Studio 2008

Hi, does anyone know how to get intellisense to work reliably when working in C/C++ projects? It seems to work for about 1 in 10 files. Visual Studio 2005 seems to be a lot better than 2008. Edit: Whilst not necessarily a solution, the work-around provided here: http://stackoverflow.com/questions/39474/how-to-get-intellisense-to-relia...

Using C in a shared multi-platform POSIX environment.

I write tools that are used in a shared workspace. Since there are multiple OS's working in this space, we generally use Python and standardize the version that is installed across machines. However, if I wanted to write some things in C, I was wondering if maybe I could have the application wrapped in a Python script, that detected the ...

Return function pointer to a nested function in C

As the title already states, I'm trying to declare a nested function and return a pointer to that function. I want this function 'not' to return a new function pointer which will return the negation of whatever the original function was. Here is what I have: someType not( someType original ) { int isNot( ListEntry* entry ) { ...

How to wrap a function with variable length arguments?

I am looking to do this in C/C++. I came across Variable Length Arguments but this suggests a solution with Python & C using libffi. Now, if i want to wrap printf function with myprintf i do like below: void myprintf(char* fmt, ...) { va_ list args; va_ start(args,fmt); printf(fmt,args); va_ end(args); } int _tmain(i...

Creating Windows service without Visual Studio

So creating a Windows service using Visual Studio is fairly trivial. My question goes a bit deeper as to what actually makes an executable installable as a service & how to write a service as a straight C application. I couldn't find a lot of references on this, but I'm presuming there has to be some interface I can implement so my .ex...

function declaration isn't a prototype

I have a library I created, mylib.c: #include <mylib.h> int testlib() { printf("Hello world\n"); return (0); } mylib.h: #include <stdio.h> extern int testlib(); In my program, I've attempted to call this library function: myprogram.c: #include <mylib.h> int main (int argc, char *argv[]) { testlib(); return (0); ...

Tool to track #include dependencies

Any good suggestions? Input will be the name of a header file and output should be a list (preferably a tree) of all files including it directly or indirectly. ...

How do I SCP a File programatically using C

What would be the best way to do an scp or sftp copy in a unix environment using C. I'm interested in knowing the best library to use and an example if at all possible. I'm working on a solaris server with the sun tools installed. ...

best way to get user input for a menu driven CLI in C

What's the best way to get user input in a C program where the choices are of a limited number. Say for example the choices are: A) Print the list. B) Add 99 to the end of the list. C) Delete all duplicates. 5) Reset 5 times. Entering "A" then enter is ok, Or, just a single keystroke would work as well. ...

How can I get markdown to format this code properly ?

Here is some code I could not get to format properly in markdown, this is straight C code, pasted into the text box with the '4 spaces' format to denote code: #define PRINT(x, format, ...) \ if ( x ) { \ if ( debug_fd != NULL ) { \ fprintf(debug_fd, format, ##__VA_ARGS__); \ } \ else { \ ...

RDMS for C language newbie?

what database system should a beginner in c language to use? Can i use MySQL? Thanks ...

Best way to multi-thread?

What is the best way to multi-thread in c language? Very efficient or not CPU hog. Thanks ...

How can I run an external program from C and parse its output?

I've got a utility that outputs a list of files required by a game. How can I run that utility within a C program and grab its output so I can act on it within the same program? UPDATE: Good call on the lack of information. The utility spits out a series of strings, and this is supposed to be complete portable across Mac/Windows/Linux...

Octal number literals: when? why? ever?

I have never used octal numbers in my code nor come across any code that used it (hexadecimal and bit twiddling notwithstanding). I started programming in C/C++ about 1994 so maybe I'm too young for this? Does older code use octal? C includes support for these by prepending a 0, but where is the code that uses these base 8 number litera...

How do I get started in embedded programming?

I would like to get started in embedded systems programming but don't know where to start...I have a very solid knowledge of C and C++ and would preferably like to use these languages with the GNU compilers. I have a degree in CS so I have a solid foundation... I have no clue about what hardware and other resources that I will need...I...

How to change the Title of the command prompt window

How can I change the title of the command prompt window every time I execute a dos-based program by double clicking it, in c language. Should I use the Windows API? ...

fprintf return success but can't write to an existin file

In my codes, fprintf return successful by returning the number of bytes written in STREAM, but in the actual file the string I put is not there. ...