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. reading text into CString

reading text into CString

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
8 Posts 4 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.
  • R Offline
    R Offline
    RalfPeter
    wrote on last edited by
    #1

    Hallo all, can anyone tell me how to read in a line of text into a CString variable in and MDI MFC appln? All I want to do is to parse a text line-by-line from the active child window into the variable. I have a very simple text editor where the view is inherited from CEditView. thx, Ralf.

    ralf.riedel@usm.edu

    T M 2 Replies Last reply
    0
    • R RalfPeter

      Hallo all, can anyone tell me how to read in a line of text into a CString variable in and MDI MFC appln? All I want to do is to parse a text line-by-line from the active child window into the variable. I have a very simple text editor where the view is inherited from CEditView. thx, Ralf.

      ralf.riedel@usm.edu

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      use CString::Find() to search the next '\n' character, and use CString::Mid() to extract the portion between the previous Find() result and the new one...


      Don't know where to start ?
      Refer the Forums Guidelines and ask a friend

      [VisualCalc 3.0][Flags Beginner's Guide]

      1 Reply Last reply
      0
      • R RalfPeter

        Hallo all, can anyone tell me how to read in a line of text into a CString variable in and MDI MFC appln? All I want to do is to parse a text line-by-line from the active child window into the variable. I have a very simple text editor where the view is inherited from CEditView. thx, Ralf.

        ralf.riedel@usm.edu

        M Offline
        M Offline
        Mahesh Kulkarni
        wrote on last edited by
        #3

        You can do it bye using the recursive call of CString::Find() for "\r\n" then use the CString::Mid. The appropriate use of of the above given method will help you to get the expected result.

        The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

        T R 2 Replies Last reply
        0
        • M Mahesh Kulkarni

          You can do it bye using the recursive call of CString::Find() for "\r\n" then use the CString::Mid. The appropriate use of of the above given method will help you to get the expected result.

          The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          can you tell me in what is your reply different from mine ?! :confused::~ moreover, please edit the HTML in your name, you're breaking the pages formatting[^] :suss:


          Don't know where to start ?
          Refer the Forums Guidelines and ask a friend

          [VisualCalc 3.0][Flags Beginner's Guide]

          R 1 Reply Last reply
          0
          • T toxcct

            can you tell me in what is your reply different from mine ?! :confused::~ moreover, please edit the HTML in your name, you're breaking the pages formatting[^] :suss:


            Don't know where to start ?
            Refer the Forums Guidelines and ask a friend

            [VisualCalc 3.0][Flags Beginner's Guide]

            R Offline
            R Offline
            RalfPeter
            wrote on last edited by
            #5

            Actually, my question is not that one. Sorry about the confusion. I was asking how to capture a string from the active child. I think I'd have to have a pointer to that child and somehow read its contents. Once I have that taken care of, then yes, I'd use CString's methods. Thx, Ralf.

            ralf.riedel@usm.edu

            T 1 Reply Last reply
            0
            • M Mahesh Kulkarni

              You can do it bye using the recursive call of CString::Find() for "\r\n" then use the CString::Mid. The appropriate use of of the above given method will help you to get the expected result.

              The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

              R Offline
              R Offline
              RalfPeter
              wrote on last edited by
              #6

              Actually, my question is not that one. Sorry about the confusion. I was asking how to capture a string from the active child. I think I'd have to have a pointer to that child and somehow read its contents. Once I have that taken care of, then yes, I'd use CString's methods. Thx, Ralf.

              ralf.riedel@usm.edu

              H 1 Reply Last reply
              0
              • R RalfPeter

                Actually, my question is not that one. Sorry about the confusion. I was asking how to capture a string from the active child. I think I'd have to have a pointer to that child and somehow read its contents. Once I have that taken care of, then yes, I'd use CString's methods. Thx, Ralf.

                ralf.riedel@usm.edu

                T Offline
                T Offline
                toxcct
                wrote on last edited by
                #7

                you have to use CWnd::GetWindowText() on the control you wan't to get the text from


                Don't know where to start ?
                Refer the Forums Guidelines and ask a friend

                [VisualCalc 3.0][Flags Beginner's Guide]

                1 Reply Last reply
                0
                • R RalfPeter

                  Actually, my question is not that one. Sorry about the confusion. I was asking how to capture a string from the active child. I think I'd have to have a pointer to that child and somehow read its contents. Once I have that taken care of, then yes, I'd use CString's methods. Thx, Ralf.

                  ralf.riedel@usm.edu

                  H Offline
                  H Offline
                  Hamid Taebi
                  wrote on last edited by
                  #8

                  You can use of GetWindowTextor WM_GETTEXT


                  WhiteSky


                  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