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. Split a string

Split a string

Scheduled Pinned Locked Moved C / C++ / MFC
c++helptutorialcareer
4 Posts 3 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.
  • M Offline
    M Offline
    manju 123
    wrote on last edited by
    #1

    Hi all. I am having a string.. say for example "bangalore". I want to display only first 6 character i.e "bangal". I am trying with different method ..I am getting the last 6 character i.e "galore".can anyone help me.. thank you manju

    Hi.. I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++ manju

    J R 2 Replies Last reply
    0
    • M manju 123

      Hi all. I am having a string.. say for example "bangalore". I want to display only first 6 character i.e "bangal". I am trying with different method ..I am getting the last 6 character i.e "galore".can anyone help me.. thank you manju

      Hi.. I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++ manju

      J Offline
      J Offline
      Joseph Marzbani
      wrote on last edited by
      #2

      char chBuffer[25]={0};
      char* pchString = "Your String";
      lstrcpy(chBuffer, pchString);
      chBuffer[6]=0;

      Now: ----- chBuffer == "Your S" and pchString == "Your String"

      1 Reply Last reply
      0
      • M manju 123

        Hi all. I am having a string.. say for example "bangalore". I want to display only first 6 character i.e "bangal". I am trying with different method ..I am getting the last 6 character i.e "galore".can anyone help me.. thank you manju

        Hi.. I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++ manju

        R Offline
        R Offline
        Rajesh R Subramanian
        wrote on last edited by
        #3

        manju#123 wrote:

        say for example "bangalore". I want to display only first 6 character i.e "bangal".

        I know you are using MFC. So,

        CString str = _T("Bangalore");
        AfxMessageBox(str.Left(6));

        Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

        M 1 Reply Last reply
        0
        • R Rajesh R Subramanian

          manju#123 wrote:

          say for example "bangalore". I want to display only first 6 character i.e "bangal".

          I know you are using MFC. So,

          CString str = _T("Bangalore");
          AfxMessageBox(str.Left(6));

          Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche .·´¯`·->Rajesh<-·´¯`·. [Microsoft MVP - Visual C++]

          M Offline
          M Offline
          manju 123
          wrote on last edited by
          #4

          Hi.. Thank you very much... manju

          Hi.. I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++ manju

          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