고 ¶
대략 CFile ¶
Data Members
Construction
Input/Output
Position
Locking
Status
Static
| m_hFile | Usually contains the operating-system file handle. |
| CFile | Constructs a CFile object from a path or file handle. |
| Abort | Closes a file ignoring all warnings and errors. |
| Duplicate | Constructs a duplicate object based on this file. |
| Open | Safely opens a file with an error-testing option. |
| Close | Closes a file and deletes the object. |
| Read | Reads (unbuffered) data from a file at the current file position. |
| ReadHuge | Can read more than 64K of (unbuffered) data from a file at the current file position. Obsolete in 32-bit programming. See Read. |
| Write | Writes (unbuffered) data in a file to the current file position. |
| WriteHuge | Can write more than 64K of (unbuffered) data in a file to the current file position. Obsolete in 32-bit programming. See Write. |
| Flush | Flushes any data yet to be written. |
| Seek | Positions the current file pointer. |
| SeekToBegin | Positions the current file pointer at the beginning of the file. |
| SeekToEnd | Positions the current file pointer at the end of the file. |
| GetLength | Retrieves the length of the file. |
| SetLength | Changes the length of the file. |
| LockRange | Locks a range of bytes in a file. |
| UnlockRange | Unlocks a range of bytes in a file. |
| GetPosition | Retrieves the current file pointer. |
| GetStatus | Retrieves the status of this open file. |
| GetFileName | Retrieves the filename of the selected file. |
| GetFileTitle | Retrieves the title of the selected file. |
| GetFilePath | Retrieves the full file path of the selected file. |
| SetFilePath | Sets the full file path of the selected file. |
| Rename | Renames the specified file (static function). |
| Remove | Deletes the specified file (static function). |
| GetStatus | Retrieves the status of the specified file (static, virtual function). |
| SetStatus | Sets the status of the specified file (static, virtual function). |
CFile Prototype ¶
라 -_-
력 부 "TestFile.txt"라는 만들고,
CFile 래 내 Write() 를 'A' ~ 'Z' 까 는 (OnWriteFile()),
'A' ~ 'Z'까 러들 면 력는 (OnReadFile()) 다.
기본로 밍 맵 게 되면 맵 기
OnWriteFile() Open() Write() 를 게 될것 같다.
그리고 밍 게 게 되면 그 맵 려 므로,
기본 Read() 것 같다.
그러나 밍 게는 txt 라 bitmap 로 과 기가 가능 므로,
가면 고, 가면 그린것 면로 복고 , 가면 는 가 되 다.
그 나머 과 반 내 동므로 기본 CFile 부 것 같다.
#include "stdafx.h"
#include "FileioView.h"
void CFileioView::OnWritefile()
{
CFile Wfile;
if(!Wfile.Open("TestFile.txt", CFile::modeCreate | CFile::modeWrite))
{
::MessageBox(NULL, "Can't Create testfile.txt !", "Warning", MB_OK | MB_ICONHAND);
return;
}
char* ps = new char[27];
char* ps2 = ps;
for(int i=0;i<26;i++)
*ps2++ = 'A'+i;
*ps2 = NULL; // NULL 문로 끝나게 다.
Wfile.Write(ps,27);
Wfile.Close();
delete ps;
}
void CFileioView::OnReadfile()
{
CFile Rfile;
if(!Rfile.Open("TestFile.txt", CFile::modeRead))
{
::MessageBox(NULL, "Can't Open testfile.txt !", "Warning",
MB_OK | MB_ICONHAND);
return;
}
UINT FileLength = (UINT)Rfile.GetLength();
char* ps = new char[FileLength];
Rfile.Read(ps,FileLength);
Rfile.Close();
CPaintDC dc(this);
dc.TextOut(0,0,ps,lstrlen(ps));
delete ps;
}
CFile 래 내 Write() 를 'A' ~ 'Z' 까 는 (OnWriteFile()),
'A' ~ 'Z'까 러들 면 력는 (OnReadFile()) 다.
OnWriteFile() Open() Write() 를 게 될것 같다.
그리고 밍 게 게 되면 그 맵 려 므로,
기본 Read() 것 같다.
그러나 밍 게는 txt 라 bitmap 로 과 기가 가능 므로,
가면 고, 가면 그린것 면로 복고 , 가면 는 가 되 다.
그 나머 과 반 내 동므로 기본 CFile 부 것 같다.










