Sign in to follow this  
Followers 0
nigma_x

Trouble with INIREAD

5 posts in this topic

I'm using Visual C++.net. What I'm having problem with is getting the INIREAD to work. I have no trouble with the INIWrite function. What I'm trying to do is When the Dialog box is shown. Read the INI file and place the key value in the Edit box if one exist If not show a blank edit box.Sort of like when you click on internet option and Your current home page url is shown. What happens is the progam will compile but when I open the dialog box then click to browse for a file. The program aborts. If I comment out the READINI code. The program works fine. I click okay and the change is made and saved with the INIWrite Function. I think my variable are not being declared right. The varibles that are the same for INIWrite I think are correct but the 3 parts are incorrect. Sort of new to programing with C++ so any help would be great.

void CMsgDlg::OnBnClickedDmdsbut()
{
    // TODO: Add your control notification handler code here
    CFileDialog ldFile(TRUE);

    // Show the file open dialog and capture the result
    if (ldFile.DoModal() == IDOK)
    {
        // Get the file name selected
        AU3_IniRead("C:\\AMRSettings\\AMRSettings.ini", "Folders", "DMDS", "Enter Path", "Enter Path", 10);
        //AU3_API void WINAPI AU3_IniRead(const char *szFilename, const char *szSection, const char *szKey, const           m_DMDSstr = ldFile.GetPathName();
        // Update the dialog
        UpdateData(FALSE);
    }
}

Share this post


Link to post
Share on other sites



// Get the file name selected
        char szResult[10];
        AU3_IniRead("C:\\AMRSettings\\AMRSettings.ini", "Folders", "DMDS", "Enter Path", szResult, 10);
        // szResult constains the result

Share this post


Link to post
Share on other sites

Thanks for the help. That did it. Finally a forum that offers correct advice to newbs.

Share this post


Link to post
Share on other sites

Thanks for the help.  That did it.  Finally a forum that offers correct advice to newbs.

Any of the functions that have a "char *" parameter rather than "const char *" will return text so you must make sure you have created a "buffer" for the return data, you also tell the function how big the buffer is so that you don't try and fit too much in there :ph34r:

Share this post


Link to post
Share on other sites

I'm trying to use iniWrite to store a Bool value is that possible? If so how?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0