Try memsetting the initial varialbles to null. Then strcopy your strings
into your variables. MemSet(PText1, somesize, 0x00); StrCopy(PText1,
"Early");

-----Original Message-----
From: Matt Becker [mailto:[EMAIL PROTECTED]]
Sent: Friday, November 10, 2000 9:40 AM
To: Palm Developer Forum
Subject: Function, CharPtrs, and strcat


Could someone tell me why this function wont work?  I tried to init the
pointers, and it crashes.  Also, without them initilized, the strcat at the
bottom crashes as well.  Any ideas on how I can make this function work.
Its supposed to build a string based on
the variable TurnIn.  thanks

CharPtr ReturnTurn(Word TurnIn)
{
 CharPtr  Ptext1;
 CharPtr  Ptext2;

 Word  TurnMod;

 //Ptext1[0]='\0';
// Ptext2[0]='\0';


 TurnMod = TurnIn % 2;

 if(TurnMod == 0)
  Ptext1 = "Late ";
 if(TurnMod == 1)
  Ptext1 = "Early ";
 if((TurnIn % 24 == 0) || (TurnIn % 24 == 23))
  Ptext2 = "December";
 if((TurnIn % 24 == 1) || (TurnIn % 24 == 2))
  Ptext2 = "January";
 if((TurnIn % 24 == 3) || (TurnIn % 24 == 4))
  Ptext2 = "Febuary";
 if((TurnIn % 24 == 5) || (TurnIn % 24 == 6))
  Ptext2 = "March";
 if((TurnIn % 24 == 7) || (TurnIn % 24 == 8))
  Ptext2 = "April";
 if((TurnIn % 24 == 9) || (TurnIn % 24 == 10))
  Ptext2 = "May";
 if((TurnIn % 24 == 11) || (TurnIn % 24 == 12))
  Ptext2 = "June";
 if((TurnIn % 24 == 13) || (TurnIn % 24 == 14))
  Ptext2 = "July";
 if((TurnIn % 24 == 15) || (TurnIn % 24 == 16))
  Ptext2 = "August";
 if((TurnIn % 24 == 17) || (TurnIn % 24 == 18))
  Ptext2 = "September";
 if((TurnIn % 24 == 19) || (TurnIn % 24 == 20))
  Ptext2 = "October";
 if((TurnIn % 24 == 21) || (TurnIn % 24 == 22))
  Ptext2 = "Novemeber";


 StrCat(Ptext1,Ptext2);

 return(Ptext1);
}



-- 
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to