c

lib curl in c++ disable printing

hello, i got a small program from http://curl.haxx.se/ and while i run it always prints the webpage how can i disable the printing function #include <iostream> #include <curl/curl.h> using namespace std; int main() { CURL *curl; CURLcode res; curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, C...

How to access a structure declared in other file using extern keyword in 'c' language

I have 3 files . In one file I declared a structure and in another file which has the main, I am trying to access that structure using extern key word -------- //a.c--- include<stdio.h> extern struct k ; extern int c; int main() { extern int a,b; fun1(); fun2(); c=10; printf("%d\n",c); struct k j; j.id=89; j.m=43; pr...

difference between c's expression and c++'s expression

int main() { int i=3; (++i)++; printf("%d",i); } This programs works with g++ compiler but not gcc. If i write i++++ or ++i++ it doesn't work in cpp also. I think there is difference between c-expression and c++-expression. Can somebody explain about L-value and R-value ? ...

Apache portable runtime tutorials?

My platform is gcc 4.4.3, C89, on Ubuntu 10.4. I am looking for some tutorials or ebooks for installing and using the Apache portable runtime. So far, I have only found the links below. I was looking for something with more information. A book text book that explains everything from installing apr, to linking and compiling with your ap...

Problem using libcurl: it does not appear to get the entire page

I am having difficulty getting started with libcurl. The code below does not appear to retrieve the entire page from the specified URL. Where am I going wrong? #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <curl/curl.h> #include <curl/types.h> #include <curl/easy.h> using namespace std; char b...

How does the Import Library work? Details?

Hi guys, I know this may seem quite basic to geeks. But I want to make it crystal clear. When I want to use a Win32 DLL, usually I just call the APIs like LoadLibrary() and GetProcAdderss(). But recently, I am developing with DirectX9, and I need to add d3d9.lib, d3dx9.lib, etc files. I have heard enough that LIB is for static linking...

copying application to another machine, cannot find shared library

Hello gcc 4.4.3 c89 linux I am using log4c and have placed the inc and lib in the following directories /home/jeff/projects/gateway/tools/log4c/inc /home/jeff/projects/gateway/tools/log4c/lib In my Makefile I have specified the inc and lib path: INC_PATH = -I tools/log4c/inc LIB_PATH = -L tools/log4c/lib LIBS = -llog4c In my lib ...

Can anyone decypher why this 'find unique values' process doesn't work as intended?

The goal is that for a variable that is an array of: typedef struct { GLuint vertex; GLuint normal; } indice_pairs_t; , we want to find all the pairs that are unique and put them in an appropriate order of appearance with unique pair indices intact. For example: if initial pairs are 2 3 6 7 6 7 4 5 (the 2nd and 3rd pairs are s...

I don't understand the following C code line

I found the following thread: http://stackoverflow.com/questions/777617/calculate-broadcast-address-from-ip-and-subnet-mask and there the link to http://lpccomp.bc.ca/netmask/netmask.c Could someone please explain the following line, I don't understand: for ( maskbits=32 ; (mask & (1L<<(32-maskbits))) == 0 ; maskbits-- ) especially...

log4c documenation

Hello, gcc 4.4.3 c89 I am just getting started with log4c. However, there is very little documentation out there for how to get started with it. I am wondering does anyone know of any tutorials, articles on how to get started? Many thanks, ...

In C (Linux) how will I be able to find out whether squareroot(n) = Integer

In C (linux) how will I be able to find out if the squareroot of a number is and integer or a floating point. I want to write a program using a function pointer which adds up all the Perfect squares upto the limit sepcified. ...

How to tell printf() to get the value from the untyped (or byte-sequence) buffer

I have a buffer of raw values, say, void* buffer or better, char* buffer - a raw byte stream, for example, read from a file. I'd like the bytes in the buffer to be represented and displayed in several ways, for example, as a float, or as a long long in runtime. I'd ask a user for desired format string, for example, %10d, and pass the for...

send data from c to perl

hi for a project i need to send some data from c program to Perl program that both in running mode (Perl program in sleep mode and c program running, and c program sends data to Perl). i know that, can write this program by socket and shared memory but i have performance problem. i think shared memory is better solution, and how can i ...

Weighted Interval Scheduling problem & Dynamic program

Hi guys! My question is related to this other discussion. I'm trying to implement that algorithm using the dynamic program into a recursive call. Problem statement: Job j starts at sj, finishes at fj,and has weight or value vj. Two jobs compatible if they don't overlap. Goal: find maximum weight subset of mutually compatible jobs. ...

reinterpret_cast cast cost

My understanding is that C++ reinterpret_cast and C pointer cast is a just a compile-time functionality and that it has no performance cost at all. Is this true? ...

sequence points in c

A sequence point in imperative programming defines any point in a computer program's execution at which it is guaranteed that all side effects of previous evaluations will have been performed, and no side effects from subsequent evaluations have yet been performed. What does this mean? Can somebody please explain it in simple words?...

Buffering data from sockets?

Hi. I am trying to make a simple HTTP server that would be able to parse client requests and send responses back. Now I have a problem. I have to read and handle one line at a time in the request, and I don't know if I should: read one byte at a time, or read chunks of N bytes at a time, put them in a buffer, and then handle the byte...

What is near, far and huge pointers?

Can anyone explain me these pointers with a suitable example ... and when these pointers are used? ...

Linux C: interactive output

Hi folks. I'm developing some kind of mysql monitoring tool so I need interactive output like top command. Is there any lib that can be used for this? Thank you for you answers beforehand. ...

Creating a C++ DLL loadable by Lua

I have a small app that uses Lua linked as dll (not static). I want to load my own c++-written dll via Lua using package.loadlib (libname, funcname). For this purpose I need to export a function that follows the Lua's lua_CFunction protocol. Clearly for that reason I have to incorporate lua.h into my project and use Lua's functions to pa...