Пример использования CStdioFile
|
Ниже представлен пример использования CStdioFile.
CStdioFile Inputfile, Outputfile; CFileException FileExc; UINT nOpenFlags; CString s; nOpenFlags = CFile::modeRead; if (!Inputfile.Open("Console.txt", nOpenFlags, &FileExc)) { FileExc.ReportError(); return; } nOpenFlags = CFile::modeWrite | CFile::modeCreate; if (!Outputfile.Open("Output.txt", nOpenFlags, &FileExc)) { FileExc.ReportError(); return; } while (Inputfile.ReadString(s)) Outputfile.WriteString(s+'\n'); Inputfile.Close(); Outputfile.Close(); |