C Programming
C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
Reading a post cgi
Hi
I have a problem in reading data from stdin from CGI
Code:
char *postdata;
postdata = (char*)malloc(clen + 1);
int ret = fread(postdata, 1, clen, stdin);
The problem is...
When the user types &...
answer(183) view(362) status(

)
answer(0) view(10) status(

)
Accessibility and get_accChild
Does anyone know why get_accChild fails when i know for a fact that the child is accessible.
I know it is accessible because AccExplorer can see it. I dont know whats wrong. I am setting the vt of the VARIANT to VT_I4 and the lVal member...
answer(1) view(840) status(

)
simple C++ inheritance: "inaccessible base"
I'm stuck with a little C++ OO
I've got a compiler error I have no idea how to fix...
"16 C:\Dev-Cpp\rogue\main.cpp
`Object' is an inaccessible base of `Mobile'"
Object is the baseclass of Mobile
(Object modelling...
answer(8) view(1,689) status(

)
searching programs
i want some hard programs for debugging competition.how and where i search that
answer(0) view(7) status(

)
VirtualProtect() fails
I am attempting to modify the permissions of a given function to allow the ability to change its behavior -- self-modifying code.
Unfortunately I cannot seem to get VirtualProtect() to properly update the attributes.
Here is the curre...
answer(2) view(236) status(

)
answer(0) view(6) status(

)
Josephus Problem - array implementation
Hi, please help code the Josephus problem: "Given a group of
n men arranged in a circle under the edict that every m-th
man will be executed going around the circle until only one
remains, find the position Last(n,m) in which you...
answer(5) view(951) status(

)
warning: invalid white space character in directive
hi
i just started using linux + the cc compiler and i am getting this warning
line 10: warning: invalid white space character in directive
line 11: warning: invalid white space character in directive
its really no biggie but i wann...
answer(4) view(1,265) status(

)
C++ Questions
1.Write a program that reads in five integers and determines and prints the largest and the smallest integers in the group. Do not use the array.
2.Write a program that inputs a five digit integer, separates the integer into its individu...
answer(8) view(848) status(

)
Illegal use of this type as an expression
i have decleared a identifier,but it give me a error as this: illegal use of this type as an expression.
function code:
void gltRotateFrameLocalX(GLTFrame *pFrame, GLfloat fAngle)
{
GLTMatrix mRotation;
GLTVector3 vCross...
answer(3) view(1,207) status(

)
Pthread
The Fibonacci sequence is the series of numbers 0, 1, 1, 2, 3, 5, 8, ?Formally, it can be expressed as:
f ib0 = 0
f ib1 = 1
f ibn = f ibn-1 + f ibn-2
Write a multithreaded program that generates the Fibonacci series using either the J...
answer(3) view(806) status(

)
pthread_create returns errno 0
I'm trying to initialize a thread using pthread_create(), with all the default parameters, but I keep getting an error condition, with errno = 0. Now I looked in errno.h and there isn't any condition 0.
Does anybody know what this means...
answer(3) view(679) status(

)
Game Theory: 2D Side Scroller/Platform, Physics Question?
If I'm making a 2D game like Super Mario (either the original or Super Mario 3 (more akin to 3) ), obviously I need to load the sprites, animate the frames, scroll the background by some blitting or flipping method, collision detection, key...
answer(5) view(617) status(

)
Time conversion
I'm look for a library that will take in a given time (which will always be in GMT) and convert it to a user's local time.
So basically, if a user is running the software in Chicago and is given the time 5PM (remember, this input will al...
answer(8) view(261) status(

)
compiler installation
I am installing a compiler. The instructions are as follows. My question is. How do I Edit the PATH system variable to add the DJGPP bin subdirectory? What do I type in and where do I put it?
Create a directory for DJGPP, say C:\DJGPP.
Afte...
answer(0) view(21) status(

)
answer(0) view(21) status(

)
Has anyone ever heard of the IKM C++ test?
(Formerly known as the TeckChek C++ test)
If anyone has ever heard of this, what do you know about it? I've googled and it hasn't given me too much.
Funny thing: a 31/40 seems to be a 98 percentile. Anyone that knows the test know if ...
answer(3) view(1,181) status(

)
typecasting
char* ptr;
ptr=(char*)0x22
why the hex address is typecasted?
answer(0) view(24) status(

)
C# Arctan()?
Is there an arctan() function in C#? I need it for a programming assignment in a C# class.
answer(2) view(1,177) status(

)
Linear-time DFS implementation
I am trying to find and implement a linear time algorithm to find the articulation points in an undirected and complete graph..I will create the depth-first-tree of the graph first but I cannot do it in linear time..I have the adjacency lis...
answer(2) view(906) status(

)
answer(0) view(36) status(

)
Cannot find unistd.h in visual studio
I don't understand why it can't.
I downloaded it and put it in the header director and wrote in the code: #include "unistd.h" instead of #include <unistd.h>
however neither work, I don't understand why, especially sinc...
answer(7) view(46) status(

)
Sieve of eratosthenes
i'm trying to make a program that finds the prime numbers going from 1-300. Can some tell me what i'm doing wrong? It just won't print out anything.
#include <stdio.h>
#include <math.h>
#define intnum 300
main()
{
b...
answer(6) view(638) status(

)
STL priority queue, no 'find' function??! fsck!!
is there a simple way to 'find' an element in an STL priority queue? all the documentation i am raeding says that priority queues only support a limited subset of container operations, and 'find' does not seem to be one of them!! i need t...
answer(5) view(134) status(

)
Complex C problems for debugging competition
Hi,
we have planned to conduct C debugging competition in our campus with 4 to 5 questions to be solved in 30 minutes.I need some questions for
1.Debugging a program
2.completing a partial program
3.Writing programs to some concepts.
T...
answer(1) view(635) status(

)
Open Cash Drawer????
I need some help, how to open a cash drawer in C++ Builder
gotta send a code char 27,112,0,25,250.
in Delphi i did like:
procedure TForm2.PopDrawer;
var
f: TextFile;
begin
AssignFile(f, 'LPT1');
Rewrite(f);
//Epson
Writel...
answer(4) view(602) status(

)
answer(0) view(30) status(

)
answer(0) view(18) status(

)
SetFilePointerEx problem
Hi,
I'm trying to use SetFilePointerEx on a Windows XP machine.
On trying to compile, I get the error -
warning C4013: 'SetFilePointerEx' undefined; assuming extern returning int
Error executing cl.exe.
I have included windows.h...
answer(3) view(862) status(

)