Click here to Skip to main content
15,892,674 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help Pin
tanchinchee17-Apr-07 8:05
tanchinchee17-Apr-07 8:05 
QuestionRe: Help Pin
David Crow17-Apr-07 8:15
David Crow17-Apr-07 8:15 
AnswerMessage Closed Pin
17-Apr-07 8:24
tanchinchee17-Apr-07 8:24 
QuestionRe: Help Pin
David Crow17-Apr-07 8:27
David Crow17-Apr-07 8:27 
AnswerRe: Help Pin
tanchinchee17-Apr-07 8:33
tanchinchee17-Apr-07 8:33 
QuestionRe: Help Pin
David Crow17-Apr-07 8:40
David Crow17-Apr-07 8:40 
AnswerRe: Help Pin
tanchinchee17-Apr-07 8:43
tanchinchee17-Apr-07 8:43 
QuestionHelp needed in loading file! Pin
cyn817-Apr-07 6:22
cyn817-Apr-07 6:22 
Hi, i have a weird problem i can't seem to find the source of the problem.
I have an edit box with a button to allow browsing for file. When i debug, i found out that under outputdata>_Fb>_Str, _Str value is 0x00000000 {???}. This causes the file unable to open. Is the problem lies in any of the functions? Can anyone help me to explain what may cause this problem? Below are the codes and any replies or advice is highly appreciated:

void MyDlg::OnBrowse()
{
OPENFILENAME openfile;
openfile.lStructSize=sizeof(OPENFILENAME) ;
openfile.hwndOwner=AfxGetApp()->m_pMainWnd->m_hWnd;
openfile.lpstrFilter="Text Files (.txt)\0*.txt\0All Files (*.*)\0*.*\0";
UpdateData();
openfile.lpstrInitialDir=m_binfile;
openfile.lpstrTitle="Specify file";
openfile.lpstrCustomFilter=NULL;

CString ext=m_binfile.Right(3);
ext.MakeUpper();
openfile.nFilterIndex=1;

CString binfile=m_binfile;
binfile=binfile.Mid(binfile.ReverseFind('\\')+1);
char file[MAX_PATH];
file[0]=0;
strcpy(file,binfile);
openfile.lpstrFile=file;
openfile.nMaxFile=MAX_PATH;
openfile.lpstrFileTitle=NULL;
openfile.Flags=OFN_HIDEREADONLY;
openfile.nFileOffset=0;
openfile.nFileExtension=0;
openfile.lpstrDefExt=ext;
openfile.lCustData=0;
if (GetOpenFileName(&openfile))
{
m_binfile=file;
UpdateData(FALSE);
OnLoad();
}
}


void CICTesterDlg::OnLoad()
{
UpdateData();
CString file;
file="abc.txt";

std::ifstream outputdata;
outputdata.open(file), ios::in);
if ( !outputdata.is_open() )
{
MessageBox(_T("Unable to open file!"),_T("WARNING"),MB_ICONEXCLAMATION);
return;
}
outputdata.close();

}

QuestionRe: Help needed in loading file! Pin
Mark Salsbery17-Apr-07 6:33
Mark Salsbery17-Apr-07 6:33 
AnswerRe: Help needed in loading file! Pin
cyn817-Apr-07 6:41
cyn817-Apr-07 6:41 
GeneralRe: Help needed in loading file! Pin
Mark Salsbery17-Apr-07 7:07
Mark Salsbery17-Apr-07 7:07 
GeneralRe: Help needed in loading file! Pin
cyn817-Apr-07 7:16
cyn817-Apr-07 7:16 
GeneralRe: Help needed in loading file! Pin
Mark Salsbery17-Apr-07 7:19
Mark Salsbery17-Apr-07 7:19 
GeneralRe: Help needed in loading file! Pin
cyn817-Apr-07 7:44
cyn817-Apr-07 7:44 
GeneralRe: Help needed in loading file! Pin
Mark Salsbery17-Apr-07 7:58
Mark Salsbery17-Apr-07 7:58 
GeneralRe: Help needed in loading file! Pin
cyn817-Apr-07 8:13
cyn817-Apr-07 8:13 
QuestionRe: Help needed in loading file! Pin
David Crow17-Apr-07 8:19
David Crow17-Apr-07 8:19 
GeneralRe: Help needed in loading file! Pin
Mark Salsbery17-Apr-07 8:27
Mark Salsbery17-Apr-07 8:27 
GeneralRe: Help needed in loading file! Pin
cyn817-Apr-07 8:33
cyn817-Apr-07 8:33 
GeneralRe: Help needed in loading file! Pin
Mark Salsbery17-Apr-07 8:37
Mark Salsbery17-Apr-07 8:37 
GeneralRe: Help needed in loading file! Pin
cyn817-Apr-07 8:49
cyn817-Apr-07 8:49 
GeneralRe: Help needed in loading file! Pin
David Crow17-Apr-07 8:54
David Crow17-Apr-07 8:54 
GeneralRe: Help needed in loading file! Pin
cyn817-Apr-07 9:00
cyn817-Apr-07 9:00 
GeneralRe: Help needed in loading file! Pin
David Crow17-Apr-07 10:10
David Crow17-Apr-07 10:10 
GeneralRe: Help needed in loading file! Pin
Mark Salsbery17-Apr-07 12:36
Mark Salsbery17-Apr-07 12:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.