일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- java
- Unity
- Android
- digitalRead
- wpf
- file access
- APP
- length
- parameter
- SERIAL
- atmega328
- preprocessing
- Contour
- Overloading
- Pointer
- flutter
- Class
- stream
- aduino
- Encapusulation
- Read
- compare
- mfc
- memory
- inheritance
- public
- UNO
- Barcode
- sensor
- c++
- Today
- Total
폴크(FOLC)
MFC 테크닉 - 파일 제어 ( INI format ) 본문
# MFC를 이용하는 과정에서 HDD 에 존재하는 파일 ( ini format ) 제어
> Save, Load 형태 - Shlwapi.lib 이용
> exe 파일 위치에 test.ini 파일 생성
# 소스 코드
> #include <Shlwapi.h>
> #pragma comment(lib, "Shlwapi.lib")
GetPrivateProfileInt(szCategory, szKey, nDefValue, m_strFilePath);
WritePrivateProfileString(szCategory, szKey, strValue, m_strFilePath);
> 읽기/쓰기 부분에 대한 내용을 별도로 wrapping 해서 이용한다.
int CINIFormHelper::LoadINT(LPCTSTR szCategory, LPCTSTR szKey, int nDefValue)
{
return GetPrivateProfileInt(szCategory, szKey, nDefValue, m_strFilePath);
}
void CINIFormHelper::SaveINT(LPCTSTR szCategory, LPCTSTR szKey, int nValue)
{
CString strValue;
strValue.Format(_T("%d"), nValue);
WritePrivateProfileString(szCategory, szKey, strValue, m_strFilePath);
}
'C, C++, MFC > C, C++, MFC 테크닉' 카테고리의 다른 글
MFC 테크닉 - TimeCheck ( QPC ) (0) | 2021.12.13 |
---|---|
MFC 테크닉 - 파일 제어 ( TXT format ) (0) | 2021.12.12 |
MFC 테크닉 - 파일 제어( BIN format ) (0) | 2021.12.11 |
MFC 테크닉 - 통신 Socket ( Heartbeat - Send/Recv ) (0) | 2021.12.07 |
MFC 테크닉 - 통신 WinSock ( Client ) (0) | 2021.11.23 |