sprintf...weird !

Non-platform specific questions.

sprintf...weird !

Postby equinox » Sat Mar 21, 2009 8:46 am

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.
Attachments
Image1.jpg
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: sprintf...weird !

Postby skydereign » Sun Mar 22, 2009 6:32 am

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;
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: sprintf...weird !

Postby equinox » Sun Mar 22, 2009 6:59 am

Perfect !!

TNk1000,Sky.

Score++;
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron