Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. An example of _tcslwr with BYTE type

An example of _tcslwr with BYTE type

Scheduled Pinned Locked Moved C / C++ / MFC
data-structurestutorialquestion
2 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 12320037
    wrote on last edited by
    #1

    Hello, Can somebody please give me an example of _tcslwr function used with BYTE array as input? Thanks in advance.

    J 1 Reply Last reply
    0
    • U User 12320037

      Hello, Can somebody please give me an example of _tcslwr function used with BYTE array as input? Thanks in advance.

      J Offline
      J Offline
      Jochen Arndt
      wrote on last edited by
      #2

      This depends on the content stored in the byte array. Because the function expects a NULL terminated string, the byte array must contain such a string. You must also know the text encoding for the stored string. Assuming your byte array contains an ASCII or ANSI string, you can call _strlwr:

      _strlwr((char *)byteArray);

      The casting to char * avoids compiler warnings or errors because BYTE is unsigned (unsigned char). If the resulting string must be printed out later with Unicode builds, convert it using the MultiByteToWideChar function (Windows)[^]. If it is ASCII or uses the current code page of the user running the application, it can be also converting by assigning the lowered string to a CString:

      CString strLwr = _strlwr((char *)byteArray);

      The above will work for Unicode and multi byte builds (with Unicode builds, the string is converted to Unicode).

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups