Created
May 15, 2013 02:11
-
-
Save LilinYume/5581189 to your computer and use it in GitHub Desktop.
EOFを取るプロパティ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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