Use the Windows standard function to delete the contents of the INI file

zhaozj2021-02-16  41

Today, I saw a friend asked how to use the function provided by Windows to remove the content of the INI file. Windows didn't delete the standard function for INI file content, but we can use WritePrivateProfileString to achieve our purpose.

Assume that the C disc is called Test.ini file, the content is as follows:

[section1]

Name1 = Value1

[section2]

NEAME2 = Value2

If we want to delete

Name1 = Value1

This line of data, then this is fine.

:: WritePrivateProfileString ("Section1", "Name1", NULL, "C: //test.ini");

If we want to delete

[section1]

Name1 = Value1

This section is like this:

:: WritePrivateProfileString ("Section1", NULL, NULL, "TEST: //1.ini");

Is it very simple, this tip is that I accidentally discovered when I did a course design last year, and now I will make everyone.

转载请注明原文地址:https://www.9cbs.com/read-26348.html

New Post(0)