Page 1 of 1

sprintf...weird !

PostPosted: Sat Mar 21, 2009 8:46 am
by equinox
HI at ALL,

int s;
if(cloneindex == 1){
//textNumber = yscreen;<<--PRINT
//s = yscreen;
sprintf(text,"xscreen %d", s);<<--NO PRINT...but...
}

.. s = yscreen;
sprintf(text,"xscreen %d", s);<<--PRINT.

do not understand why.

Tnk1000.

Re: sprintf...weird !

PostPosted: Sun Mar 22, 2009 6:32 am
by skydereign
This is the same thing, but a switch. Both versions work for me... Don't know what the problem is, so maybe this will remedy it.
Code: Select all
int s;
switch(cloneindex)
{
    case 0:
    s = xscreen;
    sprintf(text, "xscreen %d", s);
    break;
    case 1:
    s = yscreen;
    sprintf(text, "yscreen %d", s);
    break;
}

Re: sprintf...weird !

PostPosted: Sun Mar 22, 2009 6:59 am
by equinox
Perfect !!

TNk1000,Sky.

Score++;