From: "A. Sinan Unur" Newsgroups: comp.os.msdos.djgpp Subject: Re: getkey() Date: 19 Oct 2001 19:17:56 GMT Organization: Cornell University Lines: 31 Sender: asu1 AT cornell DOT invalid (on 128.253.251.163) Message-ID: References: <9qpj2s$96v$1 AT cyan DOT nl DOT gxn DOT net> <9qpp2o$b1t$1 AT cyan DOT nl DOT gxn DOT net> NNTP-Posting-Host: 128.253.251.163 X-Trace: news01.cit.cornell.edu 1003519076 19859 128.253.251.163 (19 Oct 2001 19:17:56 GMT) X-Complaints-To: usenet AT news01 DOT cit DOT cornell DOT edu NNTP-Posting-Date: 19 Oct 2001 19:17:56 GMT User-Agent: Xnews/4.06.22 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Bart van den Burg" wrote in news:9qpp2o$b1t$1 AT cyan DOT nl DOT gxn DOT net: > the program gives me no compilation errors at all (compliled with > -Wall) I could be wrong here but: > you have "(int)variable" which is the same as "int(variable), so > "(char)variable" is similar to "char(variable)"? no that is so fundamentally wrong, i do not know how to begin. (int) variable means cast the variable to int no matter what it was before. on the other hand, int(x), and this only exists in C++, AFAIK, means create a new integer with the initial value x. in this case, you are not trying to intialize a new char out of x, but jsut use the value of x. > sprintf(buffer, "%c", char(x)); you definitely should use snprintf, however, instead of sprintf. or better yet, use a C++ solution if you are working in C++. Sinan. -- -------------------------------- A. Sinan Unur http://www.unur.com/