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. Processing CStringW one char at a time

Processing CStringW one char at a time

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 2 Posters 0 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.
  • C Offline
    C Offline
    csrss
    wrote on last edited by
    #1

    How would i iterate over CStringW characters? I need the equivalent of this:

    void func(wchar_t *Stuff)
    {
    int len = wcslen(Stuff);
    for(int i = 0; i < len; i++)
    {
    std::wcout << Stuff[i] << std::endl;
    }
    }

    Thanks.

    011011010110000101100011011010000110100101101110 0110010101110011

    C 1 Reply Last reply
    0
    • C csrss

      How would i iterate over CStringW characters? I need the equivalent of this:

      void func(wchar_t *Stuff)
      {
      int len = wcslen(Stuff);
      for(int i = 0; i < len; i++)
      {
      std::wcout << Stuff[i] << std::endl;
      }
      }

      Thanks.

      011011010110000101100011011010000110100101101110 0110010101110011

      C Offline
      C Offline
      csrss
      wrote on last edited by
      #2

      Alright, solved it.

      for(int i = 0; ; i++)
      {
      wchar_t ch = pString.GetAt(i);
      if(ch == 0) break;
      }

      011011010110000101100011011010000110100101101110 0110010101110011

      N 1 Reply Last reply
      0
      • C csrss

        Alright, solved it.

        for(int i = 0; ; i++)
        {
        wchar_t ch = pString.GetAt(i);
        if(ch == 0) break;
        }

        011011010110000101100011011010000110100101101110 0110010101110011

        N Offline
        N Offline
        Niklas L
        wrote on last edited by
        #3

        operator[] is defined for CString, (CStringW and CStringA), so there should be no problem using that either.

        home

        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