Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

C# StreamWriter help

  1. Jun 3, 2009 #1
    Can someone please, using the following data, show me how to write this data to a CSV file using the StreamWriter class in C#.

    Bob,1,2,3
    Jim,4,5,6
    Tom,7,8,9
     
  2. jcsd
  3. Jul 2, 2009 #2

    harborsparrow

    User Avatar
    Gold Member

    using System.IO; // file readers and writers

    string myInputLine = "some line to be written to a file";

    string fileSpecification = "C:\test1.txt";

    StreamWriter filewriter = new StreamWriter(
    fileSpecification, true, System.Text.Encoding.UTF8);

    filewriter.WriteLine(myInputLine);
    filewriter.Flush();

    filewriter.Close();
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: C# StreamWriter help
  1. C Help (Replies: 4)

  2. Help with c++ (Replies: 5)

  3. Help with C (Replies: 9)

  4. Help with C++ (Replies: 5)

Loading...