Click here to Skip to main content
15,888,454 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to create an ini file through coding. If on application path ini file is not found then application itself create the ini file with the section and the name. And after creation the default value is filled from the code. Is this possible in embedded visual c++? If yes the tell me and help me to solve this problem. My basic condition is that user never create ini file and never change the field of that ini file.Do everything from the code. Please help me. I am using embedded visual c++ 4.0.
Posted

1 solution

SQL
I create the ini file run time but whenever I write any value in the section using WriteProfileString() it requires the registry key.

CFile obFile;

if( obFile.Open( strAppIniPath, CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite ))
{
        AfxMessageBox(_T("File Opened"),IDOK,NULL);
    bResult = theApp.WriteProfileString(_T("General"), _T("FirstName"), _T("String1"));
    bResult = theApp.WriteProfileString(_T("General"),_T("LastName"), _T("String2"));
}
else
{
    AfxMessageBox(_T("Unable to Open File"),IDOK,NULL);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900