为什么在Pocket PC中创建文件会出错???
写了一个文件处理的类:namespace MPAY2
{
class FileProcess
{
string fileName;
public FileProcess(string fileName)
{
this.fileName = fileName;
}
public void CreateFile()
{
FileInfo file = new FileInfo(fileName);
if (file.Exists)
return;
else
{
FileStream stream = null;
stream = file.Create();
stream.Close();
}
}
public void DeleteFile()
{
FileInfo file = new FileInfo(fileName);
if (file.Exists)
file.Delete();
}
public void WriteToFile(string s)
{
StreamWriter write = new StreamWriter(fileName);
write.WriteLine(s);
write.Close();
}
public string ReadFromFile()
{
string s;
StreamReader read = new StreamReader(fileName);
s = read.ReadLine();
read.Close();
return s;
}
}
}
可是在pocket PC中按如下调用抱异常:NotSupportedException
FileProcess fp = new FileProcess(@"C:\temp.ini");//在C盘下创建一个temp.ini的文件
fp.CreateFile();
可是我在控制台下运行却正常.
这是怎么回事???