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. .NET (Core and Framework)
  4. Help with formatted reads from String^

Help with formatted reads from String^

Scheduled Pinned Locked Moved .NET (Core and Framework)
c++csharpdotnetdata-structureshelp
4 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.
  • L Offline
    L Offline
    largenqcd
    wrote on last edited by
    #1

    I am new to the .NET framework, but have a lot of experience with C++ and MFC. I need to do a simple thing. I am using a StreamReader to read lines of text from an ASCII file. I then need to do formatted reads on the Strings^s I get. That is, I want to read substrings, integers, floats, etc, from each line. I guess I could convert the String to a char array and use sscanf(), but that seems dumb. I can't find any documentation on how to do this. Help! By the way, are there any good books on C++ .NET that go over the class library ... Thanks in advance, Tom

    L 1 Reply Last reply
    0
    • L largenqcd

      I am new to the .NET framework, but have a lot of experience with C++ and MFC. I need to do a simple thing. I am using a StreamReader to read lines of text from an ASCII file. I then need to do formatted reads on the Strings^s I get. That is, I want to read substrings, integers, floats, etc, from each line. I guess I could convert the String to a char array and use sscanf(), but that seems dumb. I can't find any documentation on how to do this. Help! By the way, are there any good books on C++ .NET that go over the class library ... Thanks in advance, Tom

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Wy not use normal c++ stream operations or fscanf to parse the file and then convert the results to .Net String's?

      System.IO.Path.IsPathRooted() does not behave as I would expect

      L 1 Reply Last reply
      0
      • L Lost User

        Wy not use normal c++ stream operations or fscanf to parse the file and then convert the results to .Net String's?

        System.IO.Path.IsPathRooted() does not behave as I would expect

        L Offline
        L Offline
        largenqcd
        wrote on last edited by
        #3

        The only reason I haven't done that is that I thought there must be some .NET way to do it directly on the Strings, and I wanted to learn it.. (I don't have a deadline!) Thanks, Tom

        L 1 Reply Last reply
        0
        • L largenqcd

          The only reason I haven't done that is that I thought there must be some .NET way to do it directly on the Strings, and I wanted to learn it.. (I don't have a deadline!) Thanks, Tom

          L Offline
          L Offline
          largenqcd
          wrote on last edited by
          #4

          Well, I've found an answer that is workable and uses only Strings. There is a method String.Split() that lets one split the String into pieces - I use white space for the delimiter, and that gets me what I need without resorting to 'old' coding practices! Thanks, Tom

          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