System.IO.FileInfo fo = new System.IO.FileInfotextBox1.text); if (fo.Exists) { MessageBox.Show(fo.Length.ToString()); }
不好意思,上面漏了个括号: System.IO.FileInfo fo = new System.IO.FileInfo(textBox1.text);
假设想要这个路径下的文件的大小<n 怎么写?兄弟!
你那么写我编译的话出错,n>fo.length.tostring()????
System.IO.FileInfo fi = new System.IO.FileInfo(textBox1.Text.Trim()); if (fi.Exists) { if(fi.Length >= n) MessageBox.Show("File size can't more then n"); else ....; }
int n; System.IO.FileInfo fo = new System.IO.FileInfo(path.Trim()); if (fo.Exists) {
n=fo.Length;
} 编译不过去 该怎么写??
int n; => long n;
你自己去计算字符流不就是你要的吗? FileStream fs = new FileStream(handle,*****,****); int n ; n = (int) fs.Length;
if (fo.Exists)
{
MessageBox.Show(fo.Length.ToString());
}
System.IO.FileInfo fo = new System.IO.FileInfo(textBox1.text);
if (fi.Exists)
{
if(fi.Length >= n)
MessageBox.Show("File size can't more then n");
else
....;
}
System.IO.FileInfo fo = new System.IO.FileInfo(path.Trim()); if (fo.Exists)
{
n=fo.Length;
}
编译不过去 该怎么写??
FileStream fs = new FileStream(handle,*****,****);
int n ;
n = (int) fs.Length;