c

How to get the absolute path for a given relative path programmatically in Linux?

How to get the absolute path for a given relative path programmatically in Linux? Incase of Windows we have the _fullpath() API. In other words, I mean what is analogous API to _fullpath of Windows in Linux? ...

Why was Cassandra written in Java ?

Question about Cassandra Why the hell on earth would anybody write a database ENGINE in Java ? I can understand why you would want to have a Java interface, but the engine... I was under the impression that there's nothing faster than C/C++, and that a database engine shouldn't be any slower than max speed, and certainly not use garba...

Fiddler Event Log font operations

Hello again, I'd like to make the Fiddler Event Log more readable. Right now I use #### lines so I can check the different responses and self-made actions. The best thing would be the use of font operations like color, bold or italic. I could just create my own log-frame, but I'd like to use all available Fiddler functionalities. ...

C or C++ for Linux/UNIX daemon programming?

Dear stackoverflow, The topic basically says it all. I want to go more into writing daemons for Linux/UNIX systems and I want things to be fast and stable. Everything I look at seems to be written in C, however, some new projects seem to be using C++ a bit more. So if I were to start my own project, let's say a modular HTTP daemon, whi...

Convert binary format string to int, in C

How do I convert a binary string like "010011101" to an int, and how do I convert an int, like 5, to a string "101" in C? ...

How to write unit tests in plain C?

I've started to dig into the GLib documentation and discovered that it also offers a unit testing framework. But how could you do unit tests in a procedural language? Or does it require to program OO in C? ...

Unix system programming - unzipping a file programmatically

What I need to do is unzip a file, (.gz or .z), read the first line and do some stuff according to the first line read. But the C standard library doesn't seem to offer a way to do this. Is the a platform-independent way to do it? ...

VMWare-Mount not recognizing virtual disks

I have two disks as .vmdk files, and four as .vdi files. I can boot virtual machines on them with Sun xMV VirtualBox, and they work just fine. However, I want to mount them on my local computer so I can read some files off of them without starting a virtual machine. I downloaded the vmware-mount utility, but I get this error: Unable to ...

properly implmenting Dll's and libs in VC++

I want to get this straight. I know what DLL's are. I have done research on them. they are like executable except they can not be access directly. Their main purposes are to provide additional resources such as functions and variables for your application. What I do not understand is. Do you have to include the header for both libs and ...

Command arguments in compiler configurations

[edit] I meant to say "command arguments in compiler configs" . for the title. I am trying to get into game mods. And I am trying to implement the source sdk. one of the steps is to go into debugging in my compiler configurations and add some data to the command arguments -dev -sw -game "C:\Program Files (x86)\Steam\steamapps\SourceMod...

C - Reading multiple files

Hi everyone, just had a general question about how to approach a certain problem I'm facing. I'm fairly new to C so bear with me here. Say I have a folder with 1000+ text files, the files are not named in any kind of numbered order, but they are alphabetical. For my problem I have files of stock data, each file is named after the comp...

Does linux kernel reference count kernel objects?

If 2 file descriptors were dupped to the same file (i.e. 506 and STDOUT), will invoking close(506) cleanup the object associated by both and render STDOUT unusable? Or does kernel implement reference counting for its files? ...

how do i Read keypad using C + AVR controller

hi, I like to know how count the received values from. Im using an 4x4 keypad, and AVR studio as compiler for example if I press button "1" I receive a "1" but if I press button "1" again it should be an "11" and not a "2", int inputcounter; if (button = 00x1) { // what should i do instead of inputcounter++ to get "11" and n...

playing only part of a sound using FMOD

I'm trying to play only part of a sound using FMOD, say frames 50000-100000 of a 200000 frame file. I have found a couple of ways to seek forward (i.e. to start playback at frame 50000) but I have not found a way to make sure the sound stops playing at 100000. Is there any way FMOD can natively do this without having to add lbsndfile or ...

Best practices for local constants in objective-c

I see a lot of objective-c code that just #defines local constants it needs, and then proceeds on its merry way. The problem is that, as far as I know, #defines aren't scoped. Many of this is in Apple's own example code. For example, in the TableViewSuite example 5, the drawRect function in TimeZoneView.m contains the following block:...

Determining which signal interrupted my system call (Linux)

After my system call has returned because it was interrupted by a signal, is there a way to determine exactly which signal type (i.e. child process termination) caused the interruption? ...

Reversing a string in C

I know this has been asked thousands of times but I just can't find the error in my code. Could someone kindly point out what I'm doing wrong? #include <stdlib.h> #include <string.h> void reverseString(char *myString){ char temp; int len = strlen(myString); char *left = myString; // char *right = &myString[len-1]; ...

"Error: backward ref to unknown label..." in MinGW inline assembly

Once again, I play with MinGW inline assembly. #include <stdio.h> int foobar(int); int main(){ int n = 0; printf("Number: "); scanf("%d", &n); printf("\n%d",foobar(n)); return 0; } int foobar(int num){ int result = 0; asm(".intel_syntax noprefix\n"); asm("mov eax, num\n"); asm("add eax, 110b\n"); asm("sub eax, 2\n"); as...

C problem - division result is always zero

I got this C code. #include <stdio.h> int main(void) { int n, d, i; double t=0, k; scanf("%d %d", &n, &d); t = (1/100) * d; k = n / 3; printf("%.2lf\t%.2lf\n", t, k); return 0; } I want to know why my variable 't' is always zero (in the printf function) ? ...

How to use CMenu in an MFC application?

Hi! I made an MFC application, and now i want to turn off the window's close button during i do my copy operations. I did it successfull with this code: BOOL bEnable = FALSE; // To disable UINT menuf = bEnable ? (MF_BYCOMMAND) : (MF_BYCOMMAND | MF_GRAYED | MF_DISABLED); CMenu* pSM = GetSystemMenu( , FALSE ); if ( pSM ) { pSM->E...