Article View: alt.pl.comp.lang.csharp
Article #200Re: operacje na pliku
From: Marcin Hoppe
Date: Wed, 19 Nov 2003 19:37
Date: Wed, 19 Nov 2003 19:37
32 lines
1934 bytes
1934 bytes
"VotA" <vo...@gazeta.pl> wrote in message
news:bpg8s1$635$1@inews.gazeta.pl...
> Moglby mi ktos opisac podstawowe rzeczy na temat operacjach na plikach
> (tworzenie nowego pliku, odczytywanie, zapisywanie do pliku) A moze jest
> jakis kurs na sieci ktory to zawiera?
Udało mi się wysmażyć prosty przykład. Mam nadzieję, że coś pomoże:
using System;
using System.IO;
namespace ConsoleApplication1
{
class Class1
{
static void Main(string[] args)
{
string output = Console.ReadLine();
StreamWriter writer = File.CreateText("file.txt");
writer.Write(output);
writer.Close();
StreamReader reader = File.OpenText("file.txt");
string input = reader.ReadLine();
reader.Close();
Console.WriteLine("{0} == {1}: {2}", output, input, input ==
output);
}
}
}
Technical Details
Message-ID:
<bpggqb$594$1@inews.gazeta.pl>Path:
mbox-mo1.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mailReferences:
<bpg8s1$635$1@inews.gazeta.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!newsfeed.gazeta.pl!news.gazeta.pl!not-for-mail From: "Marcin Hoppe" <marcin...@spamerzy.won.gazeta.pl> Newsgroups: alt.pl.comp.lang.csharp Subject: Re: operacje na pliku Date: Wed, 19 Nov 2003 20:37:46 +0100 Organization: Portal Gazeta.pl -> http://www.gazeta.pl Lines: 33 Message-ID: <bpggqb$594$1@inews.gazeta.pl> References: <bpg8s1$635$1@inews.gazeta.pl> Reply-To: "Marcin Hoppe" <marcin...@spamerzy.won.gazeta.pl> NNTP-Posting-Host: ws23.neoplus.adsl.tpnet.pl Mime-Version: 1.0 X-Trace: inews.gazeta.pl 1069270667 5412 80.54.56.23 (19 Nov 2003 19:37:47 GMT) X-Complaints-To: use...@agora.pl NNTP-Posting-Date: Wed, 19 Nov 2003 19:37:47 +0000 (UTC) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0 X-Priority: 3 X-User: marcin.hoppe X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit