|
From: Per W. <pw...@ia...> - 2004-07-21 20:25:15
|
I think you have picked the wrong line for the error. You have the error
in:
if(contin =3D=3D '')
You might specify an empty string with "" but you may not specify an empty
character with '' - a character is always a character - just as a number
always have at least one digit. There are actually multi-character
constants too, i.e. '\r\n' is a dual-character constant. However, these
kind of character constants are a bit special and normally requires
knowledge about byte-order of the machine to be used safely.
You might write one of:
if (contin =3D=3D '\0')
or just:
if (contin =3D=3D 0)
to test for a "null" character.
/Per W
On Wed, 21 Jul 2004, Noorez Kassam wrote:
> #include <iostream>
> #include <conio.h>
> using namespace std;
>
> namespace myf
> {
> void wait(char message[], char contin)
> {
> if(contin =3D=3D '') //make sure that contin is not blank
> {
> //if it is...
> cout << "Press any key to continue...";
> while( !kbhit() )
> {
> }
> return;
> }
> cout << message << endl; //do what is told
> char get;
> while(1) //loop till we get the correct value
> {
> get =3D getch(); //'empty character constant' error
> if(get =3D=3D contin)
> {
> return;
> }
> }
> }//end wait()
> }//namespace myf
>
>
> I am trying to put this function into a library of other functions of my =
own
> but I'm getting a compile error on the marked line.
>
> _________________________________________________________________
> Take charge with a pop-up guard built on patented Microsoft=AE SmartScree=
n
> Technology
> http://join.msn.com/?pgmarket=3Den-ca&page=3Dbyoa/prem&xAPID=3D1994&DI=3D=
1034&SU=3Dhttp://hotmail.com/enca&HL=3DMarket_MSNIS_Taglines
> Start enjoying all the benefits of MSN=AE Premium right now and get the
> first two months FREE*.
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by BEA Weblogic Workshop
> FREE Java Enterprise J2EE developer tools!
> Get your free copy of BEA WebLogic Workshop 8.1 today.
> http://ads.osdn.com/?ad_id=3D4721&alloc_id=3D10040&op=3Dclick
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|