For Programmers: Free Programming Magazines  


Home > Archive > C# > February 2005 > Writing a Sequential File









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Writing a Sequential File
jerry chapman

2005-02-01, 8:58 pm

I what to write lines to a simple sequentil file from my C# program. How can
I do that?


Joep

2005-02-02, 3:57 am

create an instance of StreamWriter (from System.IO) and use its WriteLine
method, for example

"jerry chapman" <jerryc314@sbcglobal.net> wrote in message
news:QaVLd.26302$wZ2.17979@newssvr13.news.prodigy.com...
>I what to write lines to a simple sequentil file from my C# program. How
>can
> I do that?
>
>



Joep

2005-02-02, 3:57 am

i.e. something like

using System.IO;

using(StreamWriter w = new StreamWriter("somefile.txt"))
{
w.WriteLine("the first line");
w.WriteLine("the second and last line");
}

any good?

"Joep" <Staat@DeStoep.nl> wrote in message
news:420021ed$0$28991$e4fe514c@news.xs4all.nl...
> create an instance of StreamWriter (from System.IO) and use its WriteLine
> method, for example
>
> "jerry chapman" <jerryc314@sbcglobal.net> wrote in message
> news:QaVLd.26302$wZ2.17979@newssvr13.news.prodigy.com...
>
>



jerry chapman

2005-02-03, 8:58 pm

Thanks, that worked!
"Joep" <Staat@DeStoep.nl> wrote in message
news:420022a0$0$28986$e4fe514c@news.xs4all.nl...
> i.e. something like
>
> using System.IO;
>
> using(StreamWriter w = new StreamWriter("somefile.txt"))
> {
> w.WriteLine("the first line");
> w.WriteLine("the second and last line");
> }
>
> any good?
>
> "Joep" <Staat@DeStoep.nl> wrote in message
> news:420021ed$0$28991$e4fe514c@news.xs4all.nl...
WriteLine[color=darkred]
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com