Assuming you're using WinAPI (which I'm going to assume because this is the Windows forum), you probably are asking about OPENFILENAME / GetOpenFileName:
Note that like all versions of WinAPI structs/functions (which involves strings), they come in 3 flavors: char, wchar_t, and TCHAR:
char buffer[MAX_PATH] = "";
OPENFILENAMEA ofn = {0}; // note: OPENFILENAMEA, not OPENFILENAME
// the 'A' at the end specifies we want the 'char' version and not the 'TCHAR' version
// if you want the 'wchar_t' version, you want to use OPENFILENAMEW instead
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = your_hwnd; // not entirely necessary if you don't have a window
ofn.lpstrFilter = "TextFiles\0*.txt\0All Files\0*.*\0";
ofn.nFilterIndex = 1; // for some reason this is 1-based not zero-based. grrrrr
ofn.Flags = OFN_FILEMUSTEXIST; // only allow the user to open files that actually exist
// the most important bits:
ofn.lpstrFile = buffer;
ofn.nMaxFile = MAX_PATH; // size of our 'buffer' buffer
// Now that we've prepped the struct, actually open the dialog:
// the below function call actually opens the "File Open" dialog box, and returns
// once the user exits out of it
if( !GetOpenFileNameA( &ofn ) ) // <- again note the 'A' at the end, signifying the 'char' version
{
// code reaches here if the user hit 'Cancel'
}
else
{
// code reaches here if the user hit 'OK'. The full path of the file
// they selected is now stored in 'buffer'
}