I am working on a library that support multiple programming environment such as VB6 and FoxPro. I have to stick with C convention as it is the lowest common denominator. Now I have a question regarding the style.
Suppose that the function process input and returns a string. During the process, the error can happen. The current proposed ...
Is it possible to issue WMI WQL queries in plain C? And if yes, how?
...
A program I wrote about four years ago, which gets the date and time as follows:
get_the_date_and_time(char *string)
{
struct tm *now;
time_t lt;
lt = time(NULL);
now = localtime(<);
sprintf(string,asctime(now));
}
It is returning the time an hour late since the switch to Daylight Saving Time.
By changing my sy...
Having experienced the horror that is Oracle Pro*C, when dealing with dynamically specified columns, and the need for bulk operations (ANSI METHOD 4), I simply must ask:
What Ideas/Techniques can you share which makes it easier to develop/test/debug/maintain C and C++ CRUD applications which use Pro*C or Pro*C++? I am specifically int...
I have the following code snippet:
if (ABS(p43.x) < EPS && ABS(p43.y) < EPS && ABS(p43.z) < EPS) return(FALSE);
Which I'm trying to convert to C#. What does "EPS" mean?
This code is from http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline3d/
...
Why do I have to use free() when I declare a pointer such as:
int *temp = (int*)malloc(sizeof(int))
*temp = 3;
but not when I do:
int temp = 3;
...
I have been hacking on the code for Xournal in order to add auto-save functionality. My initial implementation was very dumb: every 60 or so seconds, do a save. The feature ostensibly works.
However, after testing it out for a while, I've noticed that when auto-save runs, the application temporarily freezes up, which is quite annoying i...
EDIT: apparently some of this isn't allowed/has changed in various C standards. For my own hypothetical benefit, let's pretend we're using gcc test.c with no standard or warning options.
In particular I'm looking at the under-the-hood specifics. I've added my current understanding. Am I right?
char **c1; //Size for a pointer is al...
I have a string input to my program of the form:
con*.cc
I want this to represent the regular expression, con.*.cc.
How can I do this inside a C program? Is there something like sed that I can use?
...
In standard tcp implementations (say, on bsd), does anybody know if it's possible to find out how many bytes have been ack-ed by the remote host? Calling write() on a socket returns the number of bytes written, but I believe this actually means the number of bytes that could fit into the tcp buffer (not the number of bytes written to th...
I need to utilize an array of booleans in objective-c. I've got it mostly set up, but the compiler throws a warning at the following statement:
[updated_users replaceObjectAtIndex:index withObject:YES];
This is, I'm sure, because YES is simply not an object; it's a primitive. Regardless, I need to do this, and would greatly appreciate...
Does the ANSI standard mandate logic operators to be short-circuited, in either C or C++?
I'm confused for I recall the K&R book saying your code shouldn't depend on these operations being short circuited, for they may not. Could someone please point out where in the standard it's said logic ops are always short-circuited? I'm mostly in...
Is there a way to convert a character to an integer in C?
for example,
'5' -> 5
thanks.
...
How does the compiler fill values in char array[100] = {0};? What's the magic behind it?
I wanted to know how internally compiler initializes.
Thanks in advances. Looking more such sorts of tricks.
...
I am curious to know why bit fields with same data type takes less size than with mixed
data types.
struct xyz
{
int x : 1;
int y : 1;
int z : 1;
};
struct abc
{
char x : 1;
int y : 1;
bool z : 1;
};
sizeof(xyz) = 4
sizeof(abc) = 12.
I am using VS 2005, 64bit x86 machine.
A bit machine/compiler level answe...
I am looking for an example to read an already opened COM port, the only thing that I have found is an application called PORTMON that refers to a method called ZwCreateFile.
...
Hello,
I have started to review callbacks. I found this link:
http://stackoverflow.com/questions/142789/what-is-a-callback-in-c-and-how-are-they-implemented
which has a good example of callback which is very similar to what we use at work. However, I have tried to get it to work, but I have many errors.
#include <stdio.h>
/* Is the ...
Is strlen(const char *s) defined when s is not null-terminated, and if so, what does it return?
...
A C program spits out consecutive doubles into a binary file. I wish to read them into Python. I tried using struct.unpack('d',f.read(8))
EDIT:
I used the following in C to write a random double number
r = drand48();
fwrite((void*)&r, sizeof(double), 1, data);
The Errors are now fixed but I cannot read the first value. for an all 0.0...
I'm struggling to create a generic (or untyped) array in C (I'm aware that C++ makes this easier). In a nutshell I want to allocate an array to hold an array of a specific known type (at runtime). In the real implementation it depends on user input.
I've been trying to use a enum/struct scenario following the advice found in several Goo...