Newsgroups: comp.os.msdos.djgpp From: manfred DOT heumann AT uni-bielefeld DOT de (Manni Heumann) Subject: Re: Here's the code for getpixel problem References: <63gN2.58$ix1 DOT 35635 AT newse3 DOT tampabay DOT rr DOT com> X-Newsreader: News Xpress 2.01 Date: Sat, 03 Apr 1999 10:40:05 GMT NNTP-Posting-Host: ppp36-66.hrz.uni-bielefeld.de Message-ID: <3705e1fe.0@news.uni-bielefeld.de> X-Trace: 3 Apr 1999 11:40:14 +0200, ppp36-66.hrz.uni-bielefeld.de Lines: 29 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com In article <63gN2.58$ix1 DOT 35635 AT newse3 DOT tampabay DOT rr DOT com>, jayjohnson AT rocketmail DOT com (Jay Johnson) wrote: > >The program compiles and runs but it does not produce the >expected results. > >I expected to get a value of 6 from the getpixel call. >Where have I gone wrong? > .. here! >float temp; >putpixel(buffer, 0, 0, 6); /*put a pixel on 0,0 and color it 6(white)*/ >temp=getpixel(buffer, 0, 0); /*read the 0,0 pixel and store in temp*/ >sprintf(textbuf, "getpixel:%d", temp); /*put the temp value into a string*/ You used a float where an int should have been used. Compile with warnings enabled (-Wall), and gcc will give you a warning when try to pass the float, while using a "%d" format. -- ---------------------------------------------------------------------- Manni Heumann Bielefeld, Germany ----------------------------------------------------------------------