Possible to avoid including whole standard header file because of one method?
I would like to call the "C" function fabs(double); numerous times in my program, but I don't want to include the whole header file. Is this possible? ...
I would like to call the "C" function fabs(double); numerous times in my program, but I don't want to include the whole header file. Is this possible? ...
I would like to execute php script from the C Program and store the returning content in to a C variable. I tried like following but it doesnt works: C Code: printf("calling php function\n"); execl("/usr/bin/php -q", "/var/www/html/phpinfo.php", NULL); printf("End php function\n"); Php Code: <?php echo "hello"; ?> Envir...
How do I read the bytes from a bmp file using C? ...
I do not understand pointers. Where can I learn more about them? ...
#include<stdio.h> #include<conio.h> void print(char *arr); void main() { clrscr(); char temp='r'; print(&temp); getch(); } void print(char *arr) { int arrsz=sizeof(arr); printf("size is %d",sizeof(arr)); printf("char is %c",arr); } Why do I get this output? size is 1 char is e Surely it should say cha...
All, I'm trying to build an .exe file for the K&R "Hello, world". The code given in the book is: #include <stdio.h> main() { printf("Hello, world!\n"); } When I build & run from Code::Blocks (under Windows XP), I get the prompt window with the "hello world" message. It stays open until I close it manually. However, when ...
Hi, I've got some big C programs, and I would like to know when I'm compiling this program, which header files are actually included... The simplest solution would be to print the preprocessed code and look but do you know if there's a way to compile and at the same time showing what header files are included ? ...
This is a follow up question to a previous question I asked about calculating a straight hand..not exactly the same...This is the method to read in cards- it works- but is there a better way- to do this using console input in C ... void read_cards(int num_in_rank[], int num_in_suit[]) { bool card_exists[NUM_RANKS][NUM_SUITS]; char c...
Jon Bentley in Column 1 of his book programming pearls introduces a technique for sorting a sequence of non-zero positive integers using bit vectors. I have taken the program bitsort.c from here and pasted it below: /* Copyright (C) 1999 Lucent Technologies */ /* From 'Programming Pearls' by Jon Bentley */ /* bitsort.c -- bitmap sort...
I am working on a piece of code which uses regular expressions in c. All of the regex stuff is using the standard regex c library. On line 246 of regexec.c, the line is __libc_lock_lock(dfa->lock); My program is segfaulting here and I cannot figure out why. I was trying to find where __libc_lock_lock was defined and it turns out ...
I'm writing a filter (in a pipe destined for a terminal output) that sometimes needs to "overwrite" a line that has just occurred. It works by passing stdin to stdout character-by-character until a \n is reached, and then invoking special behaviour. My problem regards how to return to the beginning of the line. The first thing I thoug...
I have a C application we have deployed to a customers site. It was compiled and runs on HP-UX. The user has reported a crash and we have obtained a core dump. So far, I've been unable to duplicate the crash in house. As you would suspect, the core file/deployed executable is completely devoid of any sort of symbols. When I load i...
I'm working on code that does nearest-neighbor queries. There are two simple ideas that underlie how a user might query for data in a search: closest N points to a given point in space. all points within a given distance. In my code, Points are put into a PointList, and the PointList is a container has the job of keeping track of the...
Where can I find an example program in C to print to a network attached HP printer. ...
I had to do a dirty Linux hack for somebody so they could start a printer with the cupsenable printername shell command while being a non-root user. I didn't want them to be able to use the entirety of the cupsenable syntax as root, so I just wrote a C wrapper that sanitizes the input in argv[1] and calls system("cupsenable sanitizedprin...
I'm trying to create a Perl hash from within a C library. Here's what I've got so far: static void add_string_to_perl_hash ( HV *hv, char * key, char *value ) { SV *obj = sv_2mortal(newSVpv(value, 0)); hv_store(hv, (const char *)key, strlen (key), obj, 0); SvREFCNT_inc(obj); } SV * do_get_test_hash () { static char *foo ="foo"...
I'm using this code for the history features in my shell: http://cc.byexamples.com/20080613/gnu-readline-how-to-keep-a-history-list-of-entered-command-lines/ but when I compile this using gcc, I got this error $ gcc filename.c /tmp/ccay2CgM.o: In function `main': rl.c:(.text+0x9): undefined reference to `rl_abort' rl.c:(.text+0x13): u...
I wanted to know How OS actually makes a program in to process. what are steps Os engages to make program a process. I mean How a Program becomes a Process, what are the parameter OS adds to kernel datastructure before making a program a process Thank you in advance. ...
In C, getopt_long does not parse the optional arguments to command line parameters parameters. When I run the program, the optional argument is not recognized like the example run below. $ ./respond --praise John Kudos to John $ ./respond --blame John You suck ! $ ./respond --blame You suck ! Here is the test code. #include <stdio.h...
Hi, i need a ptr to a static 2-dimensional array. How is this done? static uint8_t l_matrix[10][20]; void test(){ uint8_t **matrix_ptr = l_matrix; //wrong idea } i dont get it, but all kinds of errors like: warning: assignment from incompatible pointer type subscripted value is neither array nor pointer error: invalid use of f...