GetPrivateProfileSection函数

GetPrivateProfileSection
功能:
GetPrivateProfileSection =>从指定的文件中取得全部的关键字的值

DWORD GetPrivateProfileSection(
  LPCTSTR lpAppName,
  LPTSTR lpReturnedString,
  DWORD nSize,
  LPCTSTR lpFileName);

说明:
   获取指定小节所有项名和值的一个列表
  
返回值:
  Long,装载到lpReturnedString缓冲区的字符数量。如缓冲区的容量不够大,不能容下所有信息,就返回nSize-2

参数类型及说明:
  lpAppName String,欲获取的小节。注意这个字串不区分大小写
  lpReturnedString String,项和值字串的列表。每个字串都由一个NULL字符分隔,最后一个字串后面用两个NULL字符中止
  nSize Long,lpReturnedString缓冲区的大小。在windows系统中最大值为32767
  lpFileName String,初始化文件的名字。如没有指定完整路径名,windows就在Windows目录中查找文件

功能:
GetPrivateProfileSection =>从指定的文件中取得全部的关键字的值

DWORD GetPrivateProfileSection(
  LPCTSTR lpAppName,
  LPTSTR lpReturnedString,
  DWORD nSize,
  LPCTSTR lpFileName);

说明:
   获取指定小节所有项名和值的一个列表
  
返回值:
  Long,装载到lpReturnedString缓冲区的字符数量。如缓冲区的容量不够大,不能容下所有信息,就返回nSize-2

参数类型及说明:
  lpAppName String,欲获取的小节。注意这个字串不区分大小写
  lpReturnedString String,项和值字串的列表。每个字串都由一个NULL字符分隔,最后一个字串后面用两个NULL字符中止
  nSize Long,lpReturnedString缓冲区的大小。在windows系统中最大值为32767
  lpFileName String,初始化文件的名字。如没有指定完整路径名,windows就在Windows目录中查找文件

测试程序
#include <windows.h>
#include <stdio.h>
#include <string.h>

#define  WOM_WOMCLTMD_INI  "c://nsc//dat//womcltmd.ini"
int main(void)
{
    unsigned int func_rtn;
    char  StrBuf[1256];
    char  work[256];
    unsigned int   Count = 0;
    int   CountFlag = 0;
    int   CountPrivate = 0;

    memset(StrBuf, '/0', sizeof(StrBuf));
    memset(work, '/0', sizeof(work));

    memcpy(work,"Can not fined",15);


    func_rtn = GetPrivateProfileSection("womcltmd",
                             StrBuf,
                 1256,
                 WOM_WOMCLTMD_INI);

    while(Count < func_rtn)
    {
        memset(work, '/0', sizeof(work));      /*work初期化をする*/
        memcpy(work, &StrBuf[Count],strlen(&StrBuf[Count]));/**/
        CountPrivate = strlen(&StrBuf[Count]) + 1;/**/
        Count += CountPrivate;/**/
        printf("work = %s/n", work);
    }
    //printf("func_rtn = %d/nwork = %s/nStrBuf = %s/n",func_rtn,work,StrBuf);

    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值