Hi, this is such a newbie question that I'm almost embarrassed to ask it :$ ... but anyway:
I've started reading "The C Programming Language" (K&R) and I have a doubt about the getchar() function.
For example this code:
#include <stdio.h>
main(){
int c;
c = getchar();
putchar(c);
printf("\n");
}
given the entry "toomanyc...
This is probably a silly and easy question, but it seems sometimes the simplest things give me more problems!
This formula is suppose to give me a number between 0 and 100.
(200 / 23) * Abs(Mod(2987, 23) - 23 / 2)
In objective C I coded it like this:
(200 / 23) * abs(2987 % 23) - (23 / 2);
Is the formula flawed (and doesn't give a...
Hello,
I have below code.
FILE *fp;
int a;
fp=fopen("dump.bin","wb");
a = 0xffafbcdf;
fprintf(fp,"%x",a&0x3ffff);
I am trying to dump only 18 LSBits of variable a. But the value dumped in the file is 3bcdf.
My question - Is it not possible to dump/fwrite/fprintf desired number of bits which is not a multiple of 4(nibble) to...
I'm just starting to learn programming. And as of now, I know a tad bit of memory management in Objective-C. It wasn't easy learning it.
So, just out of curiosity, is the memory management employed in major languages like C, C++, Java, etc., in any way similar to what I've learned?
...
Hi.
I'm looking for a minimal and easy to learn C or C++ cross platform gui library.
In a nutshell I only need the following functionality:
application window
menu bar
some simple dialogs, File-open and save. Maybe a user-written one.
user canvas where I can draw lines an circles on.
some kind of message/event loop mechanism.
Targ...
When a C program starts and variables are assigned to memory locations, does the C standard say if that value is initialized?
// global variables
int a;
int b = 0;
static int c;
In the above code, 'b' will be initialized to 0. What is the initial value of 'a'? Is 'c' any different since it is static to this module?
...
Hello! This looks like a simple question, but I didn't find anything similar here.
Since there is no file copy function in C, we have to implement file copying ourselves, but I don't like reinventing the wheel even for trivial stuff like that, so I'd like to ask the cloud:
What code would you recommend for file copying using fopen()/f...
Logic error problem with the Gaussian Elimination code...This code was from my Numerical Methods text in 1990's. The code is typed in from the book- not producing correct output...
Sample Run:
SOLUTION OF SIMULTANEOUS LINEAR EQUATIONS
USING GAUSSIAN ELIMINATION
This program uses Gaussian Elimination to solve the
s...
Duplicate of this question.
Hi,
I want to write a small program in C/C++ which reads a small text file, and encrypts it, using a "internal" key. Then I also want to write another small program which can decrypt the encrypted file using internally the same key.
I looked at openSSL site and googled but found not simple example, has some...
Hi everyone. I always thought I knew C very well until I saw something like this in another post:
struct foo {
int x:1;
};
I would really like to know the purpose of the :1. Can anybody clue me in? Thanks.
...
I'm trying to compile a C program that I downloaded off the internet using cl.exe at the command line in Windows. This file includes gnu C library files such as getopt.h and unistd.h, which are not available by default under Windows. How can I gain access to these (while still using the cl.exe compiler).
Thanks.
...
I took Computer Networking last semester and did some C programming in linux (using gcc) for my projects. One extremely tedious thing I kept running into was if my program crashed or stalled (which I then would have to hit Ctrl+C to kill it), the network port would still be left open for a minute or so. So if I wanted to immediately run ...
From what I understand assert is a macro in C and supposedly if you use it at compile time but leave it disabled then there won't be overhead (which might not be correct I don't know).
The problem for me is that what I'd like to do is get all the variables passed to my function and print out that output, but only if I want debugging enab...
Hi,
I want to extract some kind of bmp/rgb data from jpeg files.
I had a look at libjpeg, but there seemed not to be any good documentation available.
So my questions are:
Where is documentation on libjpeg?
Can you suggest other c-based jpeg-decompression libraries?
thanks in regard
ps: I am using GNU/Linux, and c/c++
...
I'm trying to use setuid() and setgid() to set the respective id's of a program to drop privileges down from root, but to use them I need to know the uid and gid of the user I want to change to.
Is there a system call to do this? I don't want to hardcode it or parse from /etc/passwd .
Also I'd like to do this programatically rather tha...
I'd like to play a flash animation (SWF) in plain C (win32). I'm currently using the "AtlAxWin" window class to play it, but it's not very suitable.
I'd appreciate any clues to directly use the flash player or even detect (in C) if the flash player is installed.
...
In a Linux-based project that I am working on, I need to be able to find all of my child processes. It is not feasible to record every time one is started -- they need to be found after the fact. This needs to be pure C, and I'd like to do it without reading /proc. Does anyone know how to do this?
...
Anyone know of an eye-tracking library for C#, C/C++ or Objective-C? Open-source is preferable. Thanks.
...
Following up from my previous question, why is CShell so different from C?
4 - 3 + 1 = 2 in C.
4 - 3 + 1 = 0 in CShell.
Any ideas?
...