lukename 0 Light Poster

Hello guys. I have some problems with ofstream and CFileDialog. I use this code to get file location:

CFileDialog fileDlg(TRUE);
    if (fileDlg.DoModal() == IDOK) {
        FilePath = fileDlg.GetPathName();

And after that i try to write something to file wich don't exists. So ofstream have to create a new one.

std::ofstream file("file.txt", std::ios::app);

I need ofstream to create file at program's folder, but it creates file.txt at location wich i selected with CFileDialog... What am i doing wrong?
Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.