c

Difference between angle bracket < > and double quotes " " while including header files in C++?

Possible Duplicate: what is the difference between #include <filename> and #include filename What is the difference between angle bracket < > and double quotes " " while including header files in C++? I mean which files are supposed to be included using eg: #include and which files are to be included using eg: #include "MyFi...

In C are malloc(256) and malloc(sizeof(char)*256) equivalent?

I see that people often write C code such as: char *ptr = malloc(sizeof(char)*256); Is that really necessary? The standard says that sizeof(char)==1 by definition, so doesn't it make sense just to write: char *ptr = malloc(256); Thanks, Boda Cydo. ...

A better way to split a string into an array of strings in C/C++ using whitespace as a delimiter.

Sorry, my C/C++ is not that good, but the following existing code looks like garbage even to me. It also has a bug - fails when str = "07/02/2010" terminated by '\0' - . I think that instead of fixing a bug, it might as well be rewritten. In Python it is just 'kas\nhjkfh kjsdjkasf'.split(). I know this is C-ish code, but it cannot be tha...

USB modem device software in cisco routers using C

HI all, I am a final year computer science student; my project for final year is to develop a software using C or Tcl, for a CISCO router. In the latest series of routers, cisco has given a USB port for mass storage. Now I want that if I plug-in a wireless modem like Idea netsetter (a modem available in India with this name), the router...

Convert a quadratic bezier to a cubic?

What is the algorithm to convert a quadratic bezier (with 3 points) to a cubic one (with 4 points) Thanks ...

Does GetPath() return cubic or quadratic bezier control points?

Microsoft's docs say: Specifies that the corresponding point in lpPoints is a control point or ending point for a Bèzier curve. PT_BEZIERTO values always occur in sets of three. The point in the path immediately preceding them defines the starting point for the Bèzier curve. The first two PT_BEZIERTO points are...

Fastest timing resolution system

What is the fastest timing system a C/C++ programmer can use? For example: time() will give the seconds since Jan 01 1970 00:00. GetTickCount() on Windows will give the time, in milliseconds, since the system's start-up time, but is limited to 49.7 days (after that it simply wraps back to zero). I want to get the current time, or ticks...

How can I modify the keyboard repeat delay in a linux console, with or without ncurses

I'm writing a little pong clone with ncurses and C. I need to find a way to set the keyboard repeat delay to make it easier for a player to move the paddle, otherwise they are stuck hitting the down key and waiting about 50 milliseconds until the key begins to repeat. I've checked the ncurses man pages and documentation, and I can't see...

What is `*((char*)ptr+4))` doing ?

#include<stdio.h> main() { int a[]={0,2,4,6,8}; int *ptr; ptr=a; printf("%d", *((char*)ptr+4)); } *((char*)ptr+4)) What is the purpose of this? ...

REgarding ETL TOOL Enquiry

I am completed MCA in 2009.I need to get a job in 2 to 3 months,Which ETL is good to me. Where i have to learn That ETL TOOl ...

checking if time is in specific interval in C++ ?

I need to generate values according to time of the day, is there a neat way to accomplish that ? from 9-12 value should be between x - y from 6-9 value should be between a - b is there any other way than getting timeinfo struct and extracting hour out of it? ...

Are the benefits of SFIO over STDIO still valid?

I have just noticed about a library SFIO for a safe and fast IO processing in C. But it is not very up to date. The last version of library is released in 2005 and I couldn't assess that if the claimed benefits of SFIO over STDIO are still valid with comparison to the recent releases of standard IO library. Also Would it be reasonable to...

missing locale_t

Installing gtk 1.2 (package name gtk1) with macports chokes on the final make, in libintl.h line 440. extern locale_t libintl_newlocale (junk, stuff, stuff) The compiler can't find locale_t, and I'm not doing any better. The file imports locale.h, which doesn't exist, and xlocale.h, which doesn't define this type. Where should loca...

CSV into array in C.

Hi there, I'm trying to load a CSV file into a single dimentional array. I can output the contents of the CSV file, but in trying to copy it into an array I'm having a bit of trouble. Here is my existing code, which I realise is probably pretty bad but I'm teaching myself: #include <stdio.h> #include <string.h> #define MAX_LINE_LENGT...

When converting to libtool automake and autoconf can't find libtool

I'm trying to convert libcsv to use libtool so I can use it on mac os x without mangling the makefile. When I try to run the makefile generated from the tools I get the following error: ~/software/libcsv (gnu_tools) $ make tag=CC --mode=compile gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"...

LibXML internal and output encodings

I'm trying to write XML files with libxml2 in ISO-8859-1. But from the documentation it seems that for each text node that I create I'll have to convert to UTF-8 which is libxml's internal encoding. Then when calling xmlSaveFormatFileEnc() libxml converts to the target encoding and adds the encoding attribute to the document. Is this a...

choosing autoconf and automake versions

Hello guys, I see there are many version of autoconf and automake available in my ubuntu linux. If I want create a new project from scratch, what's best choice, latest versions or older versions? ...

GdkPixbuf Collection

Hello, I need to create GdkPixBuf collection. I try to save pixbufs in GList - mw->disp_list: GtkTreeIter iter; int i = 0; for (i; i < g_list_length(list) - 1; ++i) { char* file = image_list_get_current_file_path( list ); mw->p1 = gdk_pixbuf_new_from_file(file,NULL); mw->p1 = scale_pix(mw->p1,128); mw...

Fibonacci Sequence in C

This is the expected output: We are to make a C program that calculates for the Fabonacci Sequence. We're only allowed up to 3 variables and we're NOT allowed to use loops. And I don't know what to do and how to start. I hope you guys can help me. :/ ...

Reusing/incrementing c macro definition?

Is there a way to do #define A f1(); #define A A f2(); // this is wrong #define A A f3(); // this is wrong ... #define A A fn(); // this is wrong A and then get f1(); f2(); f3(); ... fn(); ...