nakka soft world !

파일 입출력 본문

프로그래밍언어/C언어

파일 입출력

nakka 2014. 3. 10. 22:39
728x90

정리는 다음에....

 

CString test;

 //CString str=_T("pw.txt");
 //CFile fp;
 //fp.Open(_T("D:\\pw.txt"),CFile::modeReadWrite);
 //CArchive arStore(&fp, CArchive::store);

 //// arStore.WriteString(_T("kmslove"));
 //// arStore.WriteString(_T("\n"));
 //arStore.ReadString(str);

 //// arStroe.Close();
 //fp.Close();


 //int buffer[100];
 //CString str, tmp;

 //CFile file;
 //file.Open(_T("D:\\pw.txt"), CFile::modeRead);
 //file.Read(buffer, 100 * sizeof(int));
 //file.Close();

 

 //char* data ="하하하";

 //CFile inFile;
 //inFile.Open( _T("D:\\pw.txt"), CFile::modeRead);
 //inFile.Write( data, strlen( data));
 //inFile.Close();


 
 int pone_num1; //전화번호 받을곳
 //int pone_num2;
 //char* txt; //-문자
 FILE* pfile;
 pfile = fopen("NAND\\POWERDIC\\TEST\\pw2.txt", "r"); //화일을 읽기
 fscanf( pfile, "%d", &pone_num1 ); //화일에서 데이터 읽기
 fclose(pfile);

 test.Format(_T("fscanf : %d"), pone_num1);

 m_pw.SetWindowText(test);
 dlg.DoModal();


 int pw = 1111;
 FILE* sfile;
 sfile = fopen("NAND\\POWERDIC\\TEST\\pw122.txt", "w"); //화일을 읽기
 fprintf(sfile, "%d", &pw ); //화일에서 데이터 저장
 fclose(sfile);

 test.Format(_T("fpcanf : %d"), pw);

 m_pw.SetWindowText(test);
 dlg.DoModal();


 CStdioFile oFile;
 CString data = _T("1111");
 oFile.Open(_T("NAND\\POWERDIC\\TEST\\pw12233.txt"), CFile::modeCreate|CFile::modeWrite );
 oFile.WriteString(data);
 oFile.Close();

728x90

'프로그래밍언어 > C언어' 카테고리의 다른 글

[C언어] 자동 변수(auto)  (0) 2015.07.13
[C언어] 정적 변수(static)  (0) 2015.07.13
[C언어] 외부 변수(extern)  (0) 2015.07.13
[C언어] 레지스터 변수(register)  (0) 2015.07.13
포인터의 사용  (0) 2014.03.10
Comments