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#
  4. Reading more than column in a text file

Reading more than column in a text file

Scheduled Pinned Locked Moved C#
helpannouncement
1 Posts 1 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.
  • I Offline
    I Offline
    ianhunt01
    wrote on last edited by
    #1

    Hi, I am used to VB6 reading a few header items below each other out of a text file followed by some columns of data such as:

    fh1 = FreeFile
    Open inPath For Input As #fh1
    Input #fh1, projfile.name
    Input #fh1, projfile.projdate
    Input #fh1, projfile.version

    For X = 1 To intNumVars
        Input #fh1, Bas(X).name, Bas(X).Min, Bas(X).Max, Bas(X).ave,
    Next X
    

    Close(fh1)

    I have been through a lot of material on StreamReader, BinaryReader etc and getting stuck. Any help (code examples) or pointers to articles, chapters would be much appreciated. The writing of the info to the file seems easy with :

    StreamWriter outFS = new StreamWriter(new FileStream(outFile, FileMode.OpenOrCreate, FileAccess.Write));
    outFS.WriteLine(strModelDesc1);
    outFS.WriteLine(strModelDesc2);
    outFS.WriteLine("{0},{1},{2}"intLayers, intStats, decAve);
    outFS.Close();

    thanks Ian

    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