扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:谢启东编译 来源:天极开发 2007年11月14日
关键字:
using namespace System; using namespace System::IO; int main() { String^ fName1 = "Io06"; if (!Path::HasExtension(fName1)) { fName1 = Path::ChangeExtension(fName1, ".dat"); } Console::WriteLine("fName1 is {0}", fName1); StreamWriter^ outStream = File::CreateText(fName1); outStream->Write("some text"); outStream->Close(); String^ fName2 = "Io06Copy.dat"; Console::WriteLine("File {0} exists is {1}", fName2, File::Exists(fName2)); File::Copy(fName1, fName2); Console::WriteLine("File {0} exists is {1}", fName2, File::Exists(fName2)); File::Delete(fName2); Console::WriteLine("File {0} exists is {1}\n", fName2, File::Exists(fName2)); FileInfo^ f = gcnew FileInfo(fName1); Console::WriteLine("fName1 is {0}", fName1); Console::WriteLine("FullName: {0}", f->FullName); Console::WriteLine("DirectoryName: {0}", f->DirectoryName); Console::WriteLine("Name: {0}\n", f->Name); Console::WriteLine("Attributes: {0}", f->Attributes); Console::WriteLine("Length: {0}\n", f->Length); Console::WriteLine("Creation Time: {0}", f->CreationTime); Console::WriteLine("LastAccessTime: {0}", f->LastAccessTime); Console::WriteLine("LastWriteTime: {0}", f->LastWriteTime); } |
fName1 is Io06.dat File Io06Copy.dat exists is False File Io06Copy.dat exists is True File Io06Copy.dat exists is False fName1 is Io06.dat FullName: e:\Seminars\C++\Ccli\Source\Io\Io06\Main\Io06.dat DirectoryName: e:\Seminars\C++\Ccli\Source\Io\Io06\Main Name: Io06.dat Attributes: Archive Length: 9 Creation Time: 6/12/2005 5:50:46 PM LastAccessTime: 6/12/2005 5:53:44 PM LastWriteTime: 6/12/2005 5:53:44 PM |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者