GetPrivateProfileString和 WritePrivateProfileString的 问题

xotao831022 2008-12-01 12:27:11
我在文本框里面 输入 数据以后就读入了 ini文件,
m_iHour11是 文本框关联的int型变量:
CString str;
str.Format("%d",m_iHour11);
::WritePrivateProfileString("Section1","hour11",str,".\\autorecord.ini");
我 现在 想 把读入的 输提取出来用GetPrivateProfileString;
现在 出现了一个 问写入的文件的 时候我 是 用 Format把int变成cstring型的;那么我 读取的时候怎么读取呢!!??关键是 读取的 时候 格式怎么 转换,好像读取的时候是读取的char型的啊 ???就几行代码请大家赐教啊??我 还要把读取的数负值给
m_iHour11变量!
...全文
171 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
n_yHHy_n 2008-12-01
  • 打赏
  • 举报
回复
m_iHour11 = (int)GetPrivateProfileInt("Section1","hour11",0,".\\autorecord.ini");
cnzdgs 2008-12-01
  • 打赏
  • 举报
回复
m_iHour11 = GetPrivateProfileInt("Section1","hour11",0,".\\autorecord.ini");
xotao831022 2008-12-01
  • 打赏
  • 举报
回复
一楼参数配置有问题啊!不行,不能 解决
cnzdgs 2008-12-01
  • 打赏
  • 举报
回复
GetPrivateProfileInt
weidong0210 2008-12-01
  • 打赏
  • 举报
回复
char *str ;
int m_iHour11;
::GetPrivateProfileString("Section1","hour11",str,".\\autorecord.ini");
m_iHour11 = atoi(str);
baoyz 2008-12-01
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 n_yHHy_n 的回复:]
m_iHour11 = (int)GetPrivateProfileInt("Section1","hour11",0,".\\autorecord.ini");
[/Quote]
对。
读int数据
UINT GetPrivateProfileInt(
LPCTSTR lpAppName, // 组名
LPCTSTR lpKeyName, // 键名
INT nDefault, // 默认数字
LPCTSTR lpFileName // 文件名
);
例:int Values=::GetPrivateProfileInt("HotKey","HotkeyVK",0,".\\Settings.ini");
Values为返回值。
luowin 2008-12-01
  • 打赏
  • 举报
回复
GetPrivateProfileInt
一条晚起的虫 2008-12-01
  • 打赏
  • 举报
回复
m_iHour11 = GetPrivateProfileInt("Section1","hour11",0,".\\autorecord.ini");
weidong0210 2008-12-01
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 xotao831022 的回复:]
一楼参数配置有问题啊!不行,不能 解决
[/Quote]
汗。。。没看仔细 GetPrivateProfileInt("Section1","hour11",0,".\\autorecord.ini");

15,976

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 界面
社区管理员
  • 界面
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧