Helo everyone

This is a discussion on Helo everyone within the C++ Programming forums, part of the General Programming Boards category; helo i have a problem i need to view a string but i view onley 2 first caracters dont know ...

  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
    32,855
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 08: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: 05-01-2010, 12:32 AM
  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, 04:33 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21