Skip to content

Instantly share code, notes, and snippets.

@LilinYume
Created May 15, 2013 02:11
Show Gist options
  • Save LilinYume/5581189 to your computer and use it in GitHub Desktop.
Save LilinYume/5581189 to your computer and use it in GitHub Desktop.
EOFを取るプロパティ
using System;
using System.IO;
class prop
{
public bool EOF {
get{
io s = new io();
return s.streamFile();
}
}
public class io
{
public bool streamFile(){
bool asEof = false;
FileStream fs;
fs = new FileStream("D:\\test.txt", FileMode.OpenOrCreate);
/*
StreamWriter sw;
sw = new StreamWriter(@".\hoge.txt");
*/
StreamReader sr;
sr = new StreamReader(fs);
if (sr.Peek() == -1){
asEof = true;
}
return asEof;
}
}
}
public class test
{
static void Main(){
prop t = new prop();
if (t.EOF == true ){
Console.WriteLine("nothing");
}else{
Console.WriteLine("ok");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment