Results 1 to 4 of 4

Thread: copy Ctrl Z

  1. #1

    Thread Starter
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    copy Ctrl Z

    I have a simple question... If I want to copy the Ctrl-Z (^Z) or ASCII 26 into a wchar_t buffer. How much size that I should allocate for the buffer? 1, 2, or 4 bytes?

    PHP Code:
        wchar_t CZ[1];
        
    memset(CZ,0,1);
        
    CZ[0] = 26
    regards,

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    sizeof(wchar_t) = 2
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    hi! parksie, do you mean i should declare with size = 2? I sis try with size 1. ie

    wchar_t CZ[1];

    and it work too why? I know 1 byte of char = 2byte of wchar_t. Am i right?

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    wchar_t CZ[1] is a bizarre thing to write because you might as well use wchar_t CZ. One wchar_t is 2 bytes, but one char is 1 byte.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

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



Click Here to Expand Forum to Full Width