Hi,
I was wondering if you could help me out with a C string problem I don't quite understand. I have a function to which I send 3 char pointers. Within this function, the char pointers are shifted and modified correctly. However, when I return to the main function from which they are called, said functions are not changed. Am I passing ...
I am making an currency change program where I would be providing exact change to the input amount, for example a value of 23 would be one 20 dollars and 3 one dollar bills
I want to restrict the user to input the value only till 2 decimal places. For example: the valid inputs are
20, 20.4, 23.44 but an invalid input would be 20.523 or ...
I am writing a plugin for audacious, and I am experiencing random segfaults. I looked around and I found that I can process the program's core dumps with gdb.
So I did that, and I got this output:
http://pastebin.com/m7d0d663d
As you can see, it says no debugging symbols where found anywhere. I want to compile audacious with debuggin...
I have developed a Win32 C/C++ application that creates dynamic WFP IP filters, however it must be run as admin to do so (due to the Windows security policy). I want to place the code that requires admin privileges in a service running with admin privileges and then call it from the application running as a normal user.
First is this th...
Hi,I am trying to explore OOP in C. I am however a C n00b and would like to pick the brilliant brains of stackoverflow :)
My code is below:
#include <stdio.h>
#include <stdlib.h>
typedef struct speaker {
void (*say)(char *msg);
} speaker;
void say(char *dest) {
printf("%s",dest);
}
speaker* NewSpeaker() {
speaker *s;
s->sa...
I've got a weird issue that almost seems like a Visual Studio 2008 issue. I have a C struct definition as follows:
static struct frame {
short typupdt;
char callarg[1+CallSiz];
char *unitarg;
XTime unitage;
XTime orgtime;
XTime newtime;
char oldstat[1+StatSiz];
char newstat[1+StatSiz];
char incdisp[1...
If I compile the source for a C-language DLL with CL.exe, how do I set the file properties including File version Product name, Product version, Copyright and so on, so that I can view these properties in Windows Explorer?
In a .NET application written in C#, I could do this with assembly attributes like [assembly: AssemblyVersion("1...
I have a couple uint8_t arrays in my c code, and I'd like to compare an arbitrary sequence bits from one with another. So for example, I have bitarray_1 and bitarray_2, and I'd like to compare bits 13 - 47 from bitarray_1 with bits 5-39 of bitarray_2. What is the most efficient way to do this?
Currently it's a huge bottleneck in my pro...
Lets say I have a function:
void split_path_file(char** p, char** f, char *pf)
{
//malloc and set *p to file path, malloc and set *f to file name
//pf is the pointer to the full file and path "C:\sponge\bob\square.pants"
// edit: leave pf in its origional state
}
Whats the best way to accomplish this?
...
Supposing I have the following type from an external library:
union foreign_t {
struct {
enum enum_t an_enum;
int an_int;
} header;
struct {
double x, y;
} point;
};
is it safe to assume the following code fragment will work as expected on different platforms and with different compilers?
struc...
I'm looking for something to abstract the standard operating system functionality in C/C++: span/kill a thread, send/receive a message, start/stop a timer, maybe even memory management, although I can probably handle that myself with my own buffer pool.
I want to to be able to develop and unit test on Linux/windows and then recompile th...
Can CreateFile() Open one file at the same time in two different thread
void new_function(void * what)
{
HANDLE h = CreateFile("c:\\tmp", GENERIC_ALL,FILE_SHARE_WRITE |
FILE_SHARE_READ , NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (h == INVALID_HANDLE_VALUE)
{
DWORD d = GetLastError();
return ;
}...
I have millions of audio files, generated based on GUId (http://en.wikipedia.org/wiki/Globally%5FUnique%5FIdentifier). How can I store these files in the file-system so that I can efficiently add more files in the same file-system and can search for a particular file efficiently. Also it should be scalable in future.
Files are named bas...
Hi
I have a doubt regarding how can we check whether a pointer passed to a function is allocated with memory or not in C ?
I have wriiten my own function in C which accepts a character pointer - buf [pointer to a buffer] and size - buf_siz [buffer size]. Actually before calling this function user has to create a buffer and allocate it ...
I posted earlier (http://stackoverflow.com/questions/1574815/c-oop-in-c-implementation-and-a-bug/1574955#1574955) about my attempt with OOP in C, however as I'm still a new to C, there are a lot of gray areas that are resulting in code issues. I have since tried to implement inheritance, but now I'm getting a new errors, any help here? I...
Objective:
I have a list of header files (about 50 of them),
And each header-file has few arrays with constant elements.
I need to write a program to count the elements of the array. And create some other form of output (which will be used by the hardware group).
My solution:
I included all the 50 odd files and wrote an application. An...
I wonder where constant variables are stored. In the same memory area as global variables? Or on the stack?
...
It seems that are several ways to call matlab in C C++ and to call C C++ in matlab. While I try to list them here, please point it out If I miss something.
To call C C++ in matlab, there are also two methods. The first one is to call functions in C shared libraries. The second one is to build C C++ code into binary MEX-files, which will...
Hi
I am trying to pass whole structure from client to server or vice-versa. Let us assume my structure as follows
struct temp {
int a;
char b;
}
I am using sendto and sending the address of the structure variable and receiving it on the other side using the recvfrom function. But I am not able to get the original data sent on the...
Hello,
I am experimenting with my first cross-platform application that needs to run on Linux Redhat 5.3 and also on Windows XP/Vista/7.
As some OSes will run x86 or 64, I am wondering about what data types to declare.
I don't want to use any libraries to achieve cross-platform portability; I would like to experiment by myself first.
...