.


:




:

































 

 

 

 


, data.dat,




 

1. , 2 char CFilerDlg:

OutString[4][20] 4 , 20 ;

InString [20] ;

 

 

2. ClassWizard- m_text1 , m_text2 - .

3. OutString[][] , . InitDialog() :

 

strcpy(OutString[0]," ");

strcpy(OutString[1]," ");

strcpy(OutString[2]," ");

strcpy(OutString[3]," ");

m_text1 = CString(OutString[0]) + CString(OutString[1]) + CString(OutString[2]) + CString(OutString[3]);

UpdateData(FALSE);

 

4. CFile:

 

 

CFile CFile
Abort ,
Open
Close
Read
ReadHuge 64 , . 32- Read()
Write
WriteHuge 64 , . 32- Write()
Flush
Seek
SeekToBegin
SeekToEnd
GetLength
SetLength
LockRange
UnlockRange
GetPosition
GetStatus
SetStatus
GetFileName
GetFileTitle
GetFilePath
SetFilePath
Rename
Remove
CFile::modeCreate
CFile::modeNoInherit
CFile::modeNoTruncate modeCreate ,
CFile::modeRead
CFile::modeReadWrite /
CFile::modeWrite
CFile::shareCompat 32- MFC. CFile::Open CFile::shareExclusive
CFile::shareDenyNone , /
CFile::shareDenyRead ,
CFile::shareDenyWrite ,
CFile::shareExclusive , /
CFile::typeBinary
CFile::typeText /

 

ClassWizard- , :

 

void CFilerDlg::OnButton1 ()

{

//() data.dat

CFile OutFile("data.dat", CFile::modeCreate|CFile::modeWrite);

for (int loop_index = 0; loop_index < 4; loop_index++)

// , loop_index ,

// 20

OutFile.Write(OutString[loop_index], 20);

//

OutFile.Close();

// data.dat

CFile InFile("data.dat", CFile::modeRead);

for (loop_index = 0; loop_index < 4; loop_index++)

{

//

InFile.Seek(20*loop_index, CFile::begin);

// 20- () InString

InFile.Read(InString,20);

//

m_text2+=CString(InString);

};

UpdateData(FALSE);

//

InFile.Close();

}

 

. !

 

. data.dat, ,





:


: 2016-09-03; !; : 289 |


:

:

- , 20 40 . - .
==> ...

1615 - | 1567 -


© 2015-2024 lektsii.org - -

: 0.01 .