Hi,
I wanted to know how to do this. I realize this is kind of esoteric knowledge, since it's not really necessary. However, it is a topic of interest to me, and I would like to know about it.
What I don't understand is how compiz works as a whole. If gtk-window-decorator is just a program by itself (which I believe it is), then how do...
Short version: I want a way to run somefunction("username") and have it return the user ID associated with username. For example somefunction("root") would return 0.
I'm writing a server program that could potentially use low-numbered ports, so it has to start as root. Obviously, I don't want it to run as root, so the plan is to let use...
Hi, I'm trying to read a file which uses 2 colons as a delimiter using fscanf. Example:
Input
:watermelon::a tasty fruit::potato::a vegetable::
Each of the produce and definitions are delimited by a colon. I'm trying to iterate through this list so that I can print out the definitions and output.
Output: (through a printf)
wa...
Hey all,
Quick C question here. We've been playing with double, triple, even quadruple pointers recently. We though we had a grasp on things until we ran into this problem...
char ***data;
data_generator(&data);
char **temp = data[0];
printf("printing temp[%d]: %s\n",0, temp[0]);
printf("printing temp[%d]: %s\n",1, temp[1]);
...
Many standard C and POSIX functions return -1 for error, and 0 on success, for example truncate, fflush, msync, etc.
int ret = truncate("/some/file", 42);
Is it better practice to check for success with ret != -1 or ret == 0, and why?
My Thoughts
It's my experience most people check for the error case (ret != -1), as there is typica...
LCD4Linux has some code where it inserts "errors" into some data regarding status bars. Character LCDs are usually limited to 8 special characters that are basically 7x8 pixel fonts, and you can draw on each font with whatever shapes you want within that space.
Anyone know where I can find information on similar algorithms?
Here's the ...
I know when I have to print I use p->real and so on but what should I write when I am reading numbers using scanf?
#include <stdio.h>
typedef struct {
int real;
int imaginary;
} complex;
void read(complex*);
void main() {
complex c;
read(&c);
}
void read(complex* p){
/*what to write in scanf*/
}
...
This classic ioccc entry is a hello world program written in c. Can anyone please provide an explanation of how it works?
Original code (syntax highlighting intentionally missing):
int i;main(){for(;i["]<i;++i){--i;}"];read('-'-'-',i+++"hell\
o, world!\n",'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
Slightly cleaner:
int i;
main...
how do I plot a histogram in c from 2 arrays?
...
Given a .so file and function name, is there any simple way to find the function's signature through bash?
Return example:
@_ZN9CCSPlayer10SwitchTeamEi
Thank you.
...
hey everyone.
i am new in programming in c, so i am trying all these things just to get the hang of the code.
so i worte the following:
// file: q7a.h
static int err_code = 3;
void printErrCode ();
///////////// END OF FILE /////////////////
// file: q7a.c
#include <stdio.h>
#include "q7a.h"
void printErrCode ()
{
printf ("%d ", err_c...
I'm currently trying to test a strcat() function that I wrote myself. Instead of printing the outputs and checking them line by line manually, I've decided to use assert from assert.h. The problem is that assert is showing errors even though the outputs look totally fine. The following is my code:
void mystrcat_test()
{
char str[BUF...
What is the fastest way to count lines and words in a text file in pure ANSI C?
A word is terminated by a space or period. Line is terminated by '\n'.
This seems to be in C++.
...
If an application does a fork() and the child dies with an abort() (due to failing an assert()), will the parent process receive a SIGCHLD?
If it's relevant this is on Debian 4 (gcc version 4.1.2).
...
Possible Duplicate:
Stupid Question Regarding If-Else's Simultaneous Execution in C++ or C
Is it possible to put some condition, so that both if and else part in an if ...else control statement can be executed without any warning or error ??
...
I just want to know what is the difference between C library and standard library?
main() is an user defined function but the name "main" and it arguments are predefined in in C library or standard library ?
...
hi all I'm having problems with my code.
the cipher actually works its just I get some odd three digit codes separated with slashes
any help would be greatly appreciated heres my code
the codes look like this but have random numbers /354/233/645/810/236
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include...
i am tried to encode the ojpeg in tiff
the decoding function works well in the all the libtiff version...
but encoding is disable....
when i tried to activate that codes it write the ojpeg tiff tags but the images are stored as new jpeg format i.e combination of both
can any body help to built the old-style jpeg in tiff encoding
...
I don't want to use system() in my C program, because system(3) blocks and this is not what I want. What is the optimal way to do it?
...
Hello,
I am looking for a high performance logging library that I will use on an embedded device.
I also want to say that I previously used PaulBunyan logging library which provided an efficient method for transferring information.
[By efficient I meant it had a solution for transferring only the __LINE__ and __FILE__ when sending dat...