Calling the GetPrivateProfileString interface failed

Questions about Wine on Linux
Post Reply
laizhufeng
Newbie
Newbie
Posts: 1
Joined: Thu Mar 21, 2024 6:52 am

Calling the GetPrivateProfileString interface failed

Post by laizhufeng »

I have written a C program to read an INI file, and I found that when a key name contains spaces, it can be read successfully on Windows, but fails to read when the executable program is run using Wine.
Here is the code of the program.

Code: Select all

#include <Windows.h>
#include <stdio.h>

#define MAX_BUFFER_SIZE 260

int main(int argc, char* argv[])
{
    char iniFile[MAX_BUFFER_SIZE];
    GetPrivateProfileString("SYS_PARA_AREA", "VFSRootPath Item", "", iniFile, MAX_BUFFER_SIZE, "CONFIG.INI");

    if (iniFile[0] != '\0')
    {
        printf("VFSRootPath Item: %s\n", iniFile);
    }
    else
    {
        printf("Failed to read VFSRootPath Item from ini file.\n");
    }
    return 0;
}
Here is the content of the INI file.

Code: Select all

[SYS_PARA_AREA]
VFSRootPath Item=C:\ProgramData\ne1\
Is there any way to solve this problem?
Post Reply