What's the best one-stop-shop "safe" C library solution on the Mac? I use quotes on "safe"/"unsafe" because there is much debate as to the benefits of certain Standard Library functions or their putatively improved alternatives.
Many traditional Standard C Library functions (e.g., vfprintf) are considered to be unsafe due to the potent...
Local function variables initialization takes processing time? e.g.:
void foo ( void ) {
char *str = "hello";
int num = 3;
}
Or, like global variables, their value is assigned already in the read-only section of the binary?
In other words: Would it be time-consuming to invoke a function that has many local variables, comparing...
Can someone look over my program and tell me if i am doing it correctly?
I am accepting user input in the form of 8 hexadecimal digits. I want to interpret those 8 digits as an IEEE 754 32-bit floating point number and will print out information about that number.
here is my output:
IEEE 754 32-bit floating point
byte order: little-e...
I'm p-invoking into a DLL that returns a void** list of struct pointers, all of the same type. From what I've read, in order to cast and get my structure out of that list, the struct needs to be considered unmanaged. The main culprits to the struct I'm trying to marshal over are the following two fields from the C side:
char name[1024];...
I'm currently reading "The C Programming Language 2nd edition" and I'm not clear about this exercise:
Functions like isupper can be implemented to save space or to save time. Explore both possibilities.
How can I implement this function?
How should I write two versions, one to save time and one to
save space (some pseudo code woul...
I'm trying to learn how to use Lua with C, so by now I want to try running a script without loading it from a file, since I don't want to be bothered with messing up with files.
Can anybody tell me which functions do I need to call for executing a simple string or what ever?
...
Why is _mysql in the MySQLdb module a C file? When the module tries to import it, I get an import error. What should I do?
...
Currently my program allows the user to enter 5 integers which are used to create an average number. This is set to five as after the fifth number is entered the loop is broken.
I am trying to implement a method which will let the user continue to add as many numbers as they like to an array from which i can then use to create an averag...
I want to open an OpenGL window ( to display and grab keystrokes / mouse events ) in MacOSX.
I don't want to use Glut (since it demandds it be the root thread).
I don't want to learn Objective C.
Is there anyway to access the OpenGL api in pure C?
Thanks!
...
Hi
Can someone please help me with compiling gtk+ (& gtkmm) at Vista cmd prompt?
I have tried recently & cannot get this to work. I feel I have all dependencies and paths correct but I obviously haven't or am missing something! I have searched the internet but haven't found specific help for this (I am also trying to compile in cygwin- b...
Hey guys,
I'm working on a netfilter module that modifies TCP ack behavior and I am having some trouble with crashes. I think my problem is that I don't fully understand the netfilter architecture (and maybe the kernel in general, I'm pretty new to this). I have two main questions:
1.) Using kmalloc with the GFP_KERNEL flag seems to ca...
How can I create a basic C app in Visual Studio, be it 2010 Ultimate or 2008 Professional? I have searched through the project templates, and can find plenty for C++, but none for C.
(I'm hoping that the compiler and debugger will be built in.)
...
I've compiled my C program using gcc 4.4.1 using the flag -g, but when I try to step through one of my functions in gdb version 7.0, I get the message: "Single stepping until exit from function _DictionaryTree_getNodeList,
which has no line number information."
Can someone tell me why this is happening?
...
I'm trying to learn C by writing a simple program to output Fibonacci numbers. It isn't working.
fibonacci.h
unsigned int fibonacci_recursive(unsigned int n);
fibonacci.c
#include <stdio.h>
#include "fibonacci.h"
main() {
unsigned int i;
for (i = 0; i < 10; i++) {
printf("%d\t%n", fibonacci_recursive(i));
}
...
What would be an efficient way of converting a delimited string into an array of strings in C (not C++)? For example, I might have:
char *input = "valgrind --leak-check=yes --track-origins=yes ./a.out"
The source string will always have only a single space as the delimiter. And I would like a malloc'ed array of malloc'ed strings char...
I am currently trying to count the number of bytes consumed by files in a certain directory. It recursively goes through all the folders on the current directory and counts the bytes of the files.
When I recursively call the function rec_bytes, I print off "Go in"... but when it returns the value... It segfaults.
I labeled the problema...
I'm writing C in Visual Studio 2010. The compiler doesn't seem to want to let me use inline variable declarations. The following code produces an error:
unsigned int fibonacci_iterative(unsigned int n) {
if (n == 0) {
return 0;
}
if (n == 1) {
return 1;
}
unsigned int prev_prev = 0; // error
unsigned int prev = 1; // error
u...
What include statement do I need to access the math functions in this C code?
unsigned int fibonacci_closed(unsigned int n) {
double term_number = (double) n;
double golden_ratio = (1 + sqrt(5)) / 2;
double numerator = pow(golden_ratio, term_number);
return round(numerator/sqrt(5));
}
I tried #include <math.h> but that didn't seem...
Insomuch as I understand "for(;;)" has no initial condition, no test condition and no increment condition, and therefore loops forever, I am curious why the test condition succeeds each loop.
Does the empty expression ";" evaluate as true in C? Or is this a special case handled by compilers?
A similar, but unrelated question.
...
int x[10],y[10];
x = y;
I am thinking of a simple hack, which would enable me to get this effect.
...