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. String Problem

String Problem

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
41 Posts 13 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 rdop

    I am useing this.

    CString DirPath;
    CString FullPath = _T("C:\\abc\\cd\\as.txt");

    int nPos = FullPath.Find( \_T('\\\\') );
    
    if( nPos >= 0 )
    {
    DirPath = FullPath.Mid( 0, nPos);
    }
    AfxMessageBox(DirPath);
    

    Then i am geting out put C: But i need to C:\abc. Plz tell me what i use. Thanks in advance

    CPalliniC Online
    CPalliniC Online
    CPallini
    wrote on last edited by
    #20

    rdop wrote:

    int nPos = FullPath.Find( _T('\\') );

    Why do you use Find, instead of (suggested) ReverseFind? :) [added] BTW since now the request is urgent, please feel free to visit www.cpallini.freeproductz.com to get the JITS (Just In Time Solution). :-D [/added]

    If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
    This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
    [My articles]

    modified on Friday, October 3, 2008 7:45 AM

    In testa che avete, signor di Ceprano?

    R S I 3 Replies Last reply
    0
    • M Michael Schubert

      You're wasting your time, Rajesh. He just wants a quick fix, he's too lazy to attempt to understand what he's doing or what he should be doing.

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

      Michael Schubert wrote:

      He just wants a quick fix

      Ah, I hadn't realized it was urgnz. :)

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

      1 Reply Last reply
      0
      • CPalliniC CPallini

        rdop wrote:

        int nPos = FullPath.Find( _T('\\') );

        Why do you use Find, instead of (suggested) ReverseFind? :) [added] BTW since now the request is urgent, please feel free to visit www.cpallini.freeproductz.com to get the JITS (Just In Time Solution). :-D [/added]

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        modified on Friday, October 3, 2008 7:45 AM

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

        I hope that you've read the entire thread. :~ BTW, the query has now become an Urgnz one. :((

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

        1 Reply Last reply
        0
        • CPalliniC CPallini

          rdop wrote:

          int nPos = FullPath.Find( _T('\\') );

          Why do you use Find, instead of (suggested) ReverseFind? :) [added] BTW since now the request is urgent, please feel free to visit www.cpallini.freeproductz.com to get the JITS (Just In Time Solution). :-D [/added]

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
          [My articles]

          modified on Friday, October 3, 2008 7:45 AM

          S Offline
          S Offline
          SandipG
          wrote on last edited by
          #23

          Its urgentzzzz plzzzz May be you want to give him link to your magic site.. :D

          Regards, Sandip.

          CPalliniC M 2 Replies Last reply
          0
          • S SandipG

            Its urgentzzzz plzzzz May be you want to give him link to your magic site.. :D

            Regards, Sandip.

            CPalliniC Online
            CPalliniC Online
            CPallini
            wrote on last edited by
            #24

            :omg: I forgot about :omg: Fixed! :-D

            If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
            This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
            [My articles]

            In testa che avete, signor di Ceprano?

            1 Reply Last reply
            0
            • S SandipG

              Its urgentzzzz plzzzz May be you want to give him link to your magic site.. :D

              Regards, Sandip.

              M Offline
              M Offline
              Michael Schubert
              wrote on last edited by
              #25

              SandipG :) wrote:

              May be you want to give him link to your magic site

              No no sir, he mustz learnz himself.

              S 1 Reply Last reply
              0
              • R rdop

                Ok i got your point what i will do.I will try to move other field.Can you give me solution of that problem. Thanks in advance

                CPalliniC Online
                CPalliniC Online
                CPallini
                wrote on last edited by
                #26

                Yes, for instance [^]. :-D

                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                [My articles]

                In testa che avete, signor di Ceprano?

                J 1 Reply Last reply
                0
                • M Michael Schubert

                  SandipG :) wrote:

                  May be you want to give him link to your magic site

                  No no sir, he mustz learnz himself.

                  S Offline
                  S Offline
                  SandipG
                  wrote on last edited by
                  #27

                  Michael Schubert wrote:

                  No no sir, he mustz learnz himself.

                  Yes the magic site will help him to learn :D You don't know about the magic site, do you?

                  Regards, Sandip.

                  M 1 Reply Last reply
                  0
                  • S SandipG

                    Michael Schubert wrote:

                    No no sir, he mustz learnz himself.

                    Yes the magic site will help him to learn :D You don't know about the magic site, do you?

                    Regards, Sandip.

                    M Offline
                    M Offline
                    Michael Schubert
                    wrote on last edited by
                    #28

                    Never mind - and yes, I do know Carlo's magic site.

                    S R 2 Replies Last reply
                    0
                    • M Michael Schubert

                      Never mind - and yes, I do know Carlo's magic site.

                      S Offline
                      S Offline
                      SandipG
                      wrote on last edited by
                      #29

                      BTW Welcome to THHB THHB[^]

                      Regards, Sandip.

                      1 Reply Last reply
                      0
                      • M Michael Schubert

                        Never mind - and yes, I do know Carlo's magic site.

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

                        And THHB stands for: Thread Hijacking Happy Brigade. :)

                        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

                          And THHB stands for: Thread Hijacking Happy Brigade. :)

                          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
                          Michael Schubert
                          wrote on last edited by
                          #31

                          Thanks for enlightening me! ;)

                          R 1 Reply Last reply
                          0
                          • M Michael Schubert

                            Thanks for enlightening me! ;)

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

                            Michael Schubert wrote:

                            Thanks for enlightening me!

                            We aim to please. :) BTW, this is just another crime of the THHB. Look how much it's been hijacked. :-\

                            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 CPalliniC 2 Replies Last reply
                            0
                            • R Rajesh R Subramanian

                              Michael Schubert wrote:

                              Thanks for enlightening me!

                              We aim to please. :) BTW, this is just another crime of the THHB. Look how much it's been hijacked. :-\

                              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
                              Michael Schubert
                              wrote on last edited by
                              #33

                              Rajesh R Subramanian wrote:

                              Look how much it's been hijacked.

                              Combined efforts really pay off. :)

                              1 Reply Last reply
                              0
                              • R Rajesh R Subramanian

                                Michael Schubert wrote:

                                Thanks for enlightening me!

                                We aim to please. :) BTW, this is just another crime of the THHB. Look how much it's been hijacked. :-\

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

                                CPalliniC Online
                                CPalliniC Online
                                CPallini
                                wrote on last edited by
                                #34

                                Hey! You and Sandip, evil guyz, are making be bouncing from this thread to my memberpage... :-D

                                If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                [My articles]

                                In testa che avete, signor di Ceprano?

                                1 Reply Last reply
                                0
                                • R rdop

                                  This type

                                  CString array[10]

                                  D Offline
                                  D Offline
                                  David Crow
                                  wrote on last edited by
                                  #35

                                  rdop wrote:

                                  CString array[10]

                                  Which will hold strings like:

                                  array[0] = "This is string 1";
                                  array[1] = "This is string 2";
                                  array[2] = "This is string 3";
                                  ...
                                  array[9] = "This is string 10";

                                  Is that really what you intended?

                                  "Love people and use things, not love things and use people." - Unknown

                                  "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                  1 Reply Last reply
                                  0
                                  • R rdop

                                    Hi All I have a problem to cut the string.How can i cut this string last file name. Old String

                                    C:\abc\cd\as.txt

                                    And i want to show New String

                                    C:\abc\cd

                                    Plz help me

                                    D Offline
                                    D Offline
                                    David Crow
                                    wrote on last edited by
                                    #36

                                    Use PathRemoveFileSpec().

                                    "Love people and use things, not love things and use people." - Unknown

                                    "The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch

                                    1 Reply Last reply
                                    0
                                    • CPalliniC CPallini

                                      Yes, for instance [^]. :-D

                                      If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                      This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                      [My articles]

                                      J Offline
                                      J Offline
                                      Jim Crafton
                                      wrote on last edited by
                                      #37

                                      Did you hear that whooshing sound? That was the sound of that link going completely over his head. However I'd like to thank everyone in this thread for contributing to my mornings entertainment. I was feeling a bit down, and this gave me more than a few chuckles. Keep up the good work gentlemen!

                                      ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

                                      CPalliniC 1 Reply Last reply
                                      0
                                      • J Jim Crafton

                                        Did you hear that whooshing sound? That was the sound of that link going completely over his head. However I'd like to thank everyone in this thread for contributing to my mornings entertainment. I was feeling a bit down, and this gave me more than a few chuckles. Keep up the good work gentlemen!

                                        ¡El diablo está en mis pantalones! ¡Mire, mire! Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! VCF Blog

                                        CPalliniC Online
                                        CPalliniC Online
                                        CPallini
                                        wrote on last edited by
                                        #38

                                        Jim Crafton wrote:

                                        However I'd like to thank everyone in this thread for contributing to my mornings entertainment. I was feeling a bit down, and this gave me more than a few chuckles.

                                        Glad of: after all we're a happy brigade [^]. :)

                                        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                        [My articles]

                                        In testa che avete, signor di Ceprano?

                                        1 Reply Last reply
                                        0
                                        • CPalliniC CPallini

                                          rdop wrote:

                                          int nPos = FullPath.Find( _T('\\') );

                                          Why do you use Find, instead of (suggested) ReverseFind? :) [added] BTW since now the request is urgent, please feel free to visit www.cpallini.freeproductz.com to get the JITS (Just In Time Solution). :-D [/added]

                                          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
                                          This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
                                          [My articles]

                                          modified on Friday, October 3, 2008 7:45 AM

                                          I Offline
                                          I Offline
                                          Iain Clarke Warrior Programmer
                                          wrote on last edited by
                                          #39

                                          You've used this before. When are you going to actually register it? Saying that, maybe the bandwidth bills would be too high, as we'd all refer people there! Iain.

                                          CPalliniC 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