<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Reading data from a .txt file using C# in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6006123#M37374</link>
    <description>&lt;P&gt;Maybe something like this would give you a push &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [CommandMethod("ReadTxt", CommandFlags.Modal)]
        public static void ReadTxtFileToCommandLine()
        {
            Document AcDoc = App.DocumentManager.MdiActiveDocument;
            Editor msg = AcDoc.Editor;
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string FileName = ofd.FileName;
                    FileStream Fstream = new FileStream(FileName, FileMode.Open);
                    StreamReader read = new StreamReader(Fstream);
                    string st = read.ReadLine();
                    while (st != null)
                    {
                        msg.WriteMessage("\n" + (st.Substring(st.IndexOf(':') + 2)));
                        st = read.ReadLine();
                    }
                    Fstream.Dispose();
                }
            }
            catch (System.Exception err)
            {
                msg.WriteMessage(err.Message);
            }
        }&lt;/PRE&gt;</description>
    <pubDate>Tue, 26 Jan 2016 06:52:45 GMT</pubDate>
    <dc:creator>_Tharwat</dc:creator>
    <dc:date>2016-01-26T06:52:45Z</dc:date>
    <item>
      <title>Reading data from a .txt file using C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6005943#M37372</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; I have a txt file that has some data that I would like to use in a C# program that I am writing. Is there an example or code snippet that I can look at that shows how to open a file and parse the data. An example of the data is listed below:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1&amp;nbsp; Arm Hole Circumference Left: 19.761&lt;BR /&gt;1&amp;nbsp; Arm Hole Circumference Right: 21.122&lt;BR /&gt;1&amp;nbsp; Bicep Circumference Left: 12.851&lt;BR /&gt;1&amp;nbsp; Bicep Circumference Right: 13.365&lt;BR /&gt;1&amp;nbsp; Forearm Circumference Left: 10.44&lt;BR /&gt;1&amp;nbsp; Forearm Circumference Right: 10.189&lt;BR /&gt;1&amp;nbsp; Wrist Circumference Left: 7.1036&lt;BR /&gt;1&amp;nbsp; Wrist Circumference Right: 6.537&lt;BR /&gt;1&amp;nbsp; Arm Length Left: 22.749&lt;BR /&gt;1&amp;nbsp; Arm Length Right: 24.094&lt;BR /&gt;1&amp;nbsp; Arm Under Length Left: 16.361&lt;BR /&gt;1&amp;nbsp; Arm Under Length Right: 17.703&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In all cases, the number at the end of the line is the one that I am interested in brining into the C# program.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ~Vonnie&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2016 01:34:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6005943#M37372</guid>
      <dc:creator>ganderson</dc:creator>
      <dc:date>2016-01-26T01:34:43Z</dc:date>
    </item>
    <item>
      <title>Re : Reading data from a .txt file using C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6006113#M37373</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Maybe something like this (not tested)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var result = new List&amp;lt;double&amp;gt;();
using (var reader = new StreamReader(filename))
{
    string line;&lt;BR /&gt;    while ((line = reader.ReadLine()) != null)
    {
	var words = string.Split(' ');
	result.Add(double.Parse(words[words.Length - 1]));
    }
}
return result;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Jan 2016 06:38:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6006113#M37373</guid>
      <dc:creator>_gile</dc:creator>
      <dc:date>2016-01-26T06:38:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from a .txt file using C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6006123#M37374</link>
      <description>&lt;P&gt;Maybe something like this would give you a push &lt;img id="smileyhappy" class="emoticon emoticon-smileyhappy" src="https://forums.autodesk.com/i/smilies/16x16_smiley-happy.png" alt="Smiley Happy" title="Smiley Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;        [CommandMethod("ReadTxt", CommandFlags.Modal)]
        public static void ReadTxtFileToCommandLine()
        {
            Document AcDoc = App.DocumentManager.MdiActiveDocument;
            Editor msg = AcDoc.Editor;
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    string FileName = ofd.FileName;
                    FileStream Fstream = new FileStream(FileName, FileMode.Open);
                    StreamReader read = new StreamReader(Fstream);
                    string st = read.ReadLine();
                    while (st != null)
                    {
                        msg.WriteMessage("\n" + (st.Substring(st.IndexOf(':') + 2)));
                        st = read.ReadLine();
                    }
                    Fstream.Dispose();
                }
            }
            catch (System.Exception err)
            {
                msg.WriteMessage(err.Message);
            }
        }&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Jan 2016 06:52:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6006123#M37374</guid>
      <dc:creator>_Tharwat</dc:creator>
      <dc:date>2016-01-26T06:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from a .txt file using C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6007849#M37375</link>
      <description>Thanks, I'll try this..</description>
      <pubDate>Tue, 26 Jan 2016 23:17:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6007849#M37375</guid>
      <dc:creator>ganderson</dc:creator>
      <dc:date>2016-01-26T23:17:22Z</dc:date>
    </item>
    <item>
      <title>Re : Reading data from a .txt file using C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6007850#M37376</link>
      <description>Thanks!</description>
      <pubDate>Tue, 26 Jan 2016 23:17:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6007850#M37376</guid>
      <dc:creator>ganderson</dc:creator>
      <dc:date>2016-01-26T23:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading data from a .txt file using C#</title>
      <link>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6008108#M37377</link>
      <description>&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;as for parsing the text file - a simple google search will yeild plenty of results because it has been done a billion times below. I just did one and came up with a good number of results and code too - freely available.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;As for getting that last number - perhaps you will need to make use of the Regex class.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="line-height: 15px;"&gt;if you have trouble with you code please feel free to post again, but i think if you go in the general direction i've outlined above, you can't lose.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2016 03:42:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/reading-data-from-a-txt-file-using-c/m-p/6008108#M37377</guid>
      <dc:creator>BKSpurgeon</dc:creator>
      <dc:date>2016-01-27T03:42:42Z</dc:date>
    </item>
  </channel>
</rss>

