Thread: Helo everyone

  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    11

    Exclamation Helo everyone

    helo
    i have a problem
    i need to view a string
    but i view onley 2 first caracters
    dont know why

    Code:
    UCHAR enc[20];
    if(setup[idx].input_enc ==0)
                {
                enc="NRZL";
                }
                else if(setup[idx].input_enc ==1)
                    {
                    enc="NRZM";
                    }
                    else if(setup[idx].input_enc ==2)
                        {
                        enc="NRZS";
                        }
                        else if(setup[idx].input_enc ==3)
                            {
                            enc="BI-PHASE";
                            }
                            else if(setup[idx].input_enc ==4)
                                {
                                enc="BI-PHASE M";
                                }
                                else
                                    {
                                    enc="BI-PHASE S";
                                    }
            sprintf(buf, "  ENC=%ls\r\n",
                      enc);
            COM1_send_str(buf);

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    1. You can't assign char arrays. Try using UCHAR *enc;
    2. Your sprintf has only %1s as the format.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I need helo sorting 2 dimention arrays
    By Iron Hide in forum C Programming
    Replies: 1
    Last Post: 04-27-2011, 07:24 PM
  2. Helo with building binary trees using pointers
    By croman in forum C Programming
    Replies: 9
    Last Post: 01-24-2011, 05:53 PM
  3. Helo with bubblesort?
    By x2x3i5x in forum C Programming
    Replies: 6
    Last Post: 04-30-2010, 11:32 PM
  4. having trouble to print helo world....
    By winggx in forum C Programming
    Replies: 2
    Last Post: 03-10-2010, 05:48 PM
  5. Function Helo
    By BB89 in forum C Programming
    Replies: 3
    Last Post: 10-18-2009, 03:33 PM