WritePrivateProfileString
GetPrivateProfileString
下面那个例子里面会在c盘下生成一个appname.ini
WritePrivateProfileString向里面写
[Section1]
FirstKey=It all worked out OK.
这些内容, 读的话也一样.
//build in vs2008
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
WritePrivateProfileString (TEXT("Section1"),
TEXT("FirstKey"),
TEXT("It all worked out OK."),
TEXT("c:\\appname.ini"))
wchar_t buf[1000]
GetPrivateProfileString(TEXT("Section1"),
TEXT("FirstKey"),
TEXT("can not read"), //如果没读到那么buf会被设置成can not read
buf,
1000,
TEXT("c:\\appname.ini"))
wprintf(TEXT("read from appname.ini [Section1] FirstKey is (%s)\n"), buf)
system("pause")
return 0
}
==================================================================
这个就是标准的c++读唤察瞎写, 2008下编译的. 如果你说是c的那只好自己封装函数了. 看你文件名明显就是个基于对话框的MFC Application, 说什么智和空能应用程序-_-!你不是没有没困include头文件吧
#include <windows.h>
BOOL CMy3Dlg::OnInitDialog()
{
CDialog::OnInitDialog()
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX &0xFFF0) == IDM_ABOUTBOX)
ASSERT(IDM_ABOUTBOX <0xF000)
CMenu* pSysMenu = GetSystemMenu(FALSE)
if (pSysMenu != NULL)
{
CString strAboutMenu
strAboutMenu.LoadString(IDS_ABOUTBOX)
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR)
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu)
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE) // Set big icon
SetIcon(m_hIcon, FALSE) // Set small icon
// TODO: Add extra initialization here
WritePrivateProfileString (TEXT("Section1"),
TEXT("FirstKey"),
TEXT("It all worked out OK."),
TEXT("c:\\appname.ini"))
wchar_t buf[1000]
GetPrivateProfileString(TEXT("Section1"),
TEXT("FirstKey"),
TEXT("NULL"),
buf,
1000,
TEXT("c:\\appname.ini"))
AfxMessageBox(buf)
return TRUE // return TRUE unless you set the focus to a control
}
完全正常
你先选择一款读写器,智能卡的读孙山余写规范是标准的其原理就是向读卡器发送则滚定义好的命令并接收返回来的数据;各厂家的读卡器都提供封装好的API接口,如果只做应用不关心底层的话,用厂家提供的接口会很简单,唯橡调用DLL的几个函数可以了。欢迎分享,转载请注明来源:内存溢出
评论列表(0条)