×

Discussion Board

Results 1 to 5 of 5

Thread: noob question?

  1. #1
    Regular Contributor
    Join Date
    Feb 2009
    Posts
    54

    descriptor question?

    how to copy an unsigned char into a descriptor( TBuf16 or TChar ). can someone help please?

    i`ve tryed this but it doesn`t work. i get user panic 9.


    Code:
    TBuf16<256> tPass;
    unsigened char pass[32];
    	
    tPass.Copy(KNullDesC);
    for(TInt i = 0; i < 16; i++)
     tPass[i] = pass[i*2] << 8 | pass[i*2 + 1];
    Last edited by andreip; 2009-06-01 at 23:47.

  2. #2
    Regular Contributor
    Join Date
    Sep 2008
    Posts
    119

    Re: descriptor question?

    Quote Originally Posted by andreip View Post
    how to copy an unsigned char into a descriptor( TBuf16 or TChar ). can someone help please?

    i`ve tryed this but it doesn`t work. i get user panic 9.


    Code:
    TBuf16<256> tPass;
    unsigened char pass[32];
    	
    tPass.Copy(KNullDesC);
    for(TInt i = 0; i < 16; i++)
     tPass[i] = pass[i*2] << 8 | pass[i*2 + 1];
    what was the error?

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    3

    Re: descriptor question?

    Quote Originally Posted by anwar21387 View Post
    what was the error?
    no error. it just leave with user panic 9

  4. #4
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: descriptor question?

    Quote Originally Posted by pandrei View Post
    no error. it just leave with user panic 9
    User Panic 9 is raised when the index value passed to the 16 bit variant descriptor Operator[] is out of bounds.

    So you should be checking the index you are passing to get the contents inside the for loop.
    Cheers,
    Mayank

  5. #5
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: descriptor question?

    tPass.Copy(KNullDesC) ensures that the length of your descriptor is 0 bytes, so any possible argument for [] will raise USER 9.
    Use
    Code:
    tPass.SetLength(16);
    instead.

Similar Threads

  1. noob question about n93
    By snowman321 in forum Wired and Wireless interfaces (Closed)
    Replies: 1
    Last Post: 2008-12-13, 09:42
  2. Question and Answer dialog
    By launch in forum Symbian User Interface
    Replies: 3
    Last Post: 2008-10-26, 14:16
  3. noob question
    By AliShafa in forum Symbian
    Replies: 8
    Last Post: 2008-04-18, 12:02
  4. another noob question :)
    By AliShafa in forum Symbian
    Replies: 5
    Last Post: 2008-04-18, 08:27
  5. Replies: 0
    Last Post: 2003-04-07, 09:52

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×