[求助]好东西
string path=@"d:\ahua\ceshi.txt";string string1="aaa";
FileStream fs=new FileStream(path,FileMode.OpenOrCreate,FileAccess.Write);
StreamWriter sw=new StreamWriter(fs);
string1.PadRight(20);//这行有问题吗?
sw.WriteLine(string1);
sw.Flush();
还是由我来解决吧,函数PadRight(20,' ')和PadRight(20)是等效的,函数的功能是返回字符串,而不是直接作用在对象上,所以应该改成string=string1.PadRight(20);这样就OK了
[此贴子已经被作者于2006-2-14 13:17:58编辑过]