open file with arbitrary name
From: David Jones (davidhere401_at_hotmail.com)
Date: 01/26/04
- Next message: Richard Heathfield: "Re: completed my Varaint class."
- Previous message: Jeffrey Turner: "Re: Help: Recursive String Length Function"
- Next in thread: Josh Sebastian: "Re: open file with arbitrary name"
- Reply: Josh Sebastian: "Re: open file with arbitrary name"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 26 Jan 2004 14:20:40 -0500
I'm writing a function to save data in the form of numbers(double). what I
do is I use a dialog box to get a filename and then try to save the data to
that file. but I get a problem because I don't think that myFile.open()
likes the type that I pass to it to give it the filename and am not sure how
to fix it. I put the basic code below but its not compilable because the
GetDlgItemText is really used in a message handler that goes with windows
programming. It's called by the dialogBox.
char fileName[20];
GetDlgItemText(hWnd, IDC_EDIT1, (LPTSTR) fileName, 20);
ofstream myFile;
myFile.open(fileName, ios::out);
if (! myFile) {
MessageBox(NULL, NULL, "WHATEVER", MB_OK);
}
//LOAD DATA FROM FILE HERE
myFile.close();
I simply think don't know what type to use for fileName. When I replace
filename with a constant like "file.txt" it works just fine.
thanks
dave
- Next message: Richard Heathfield: "Re: completed my Varaint class."
- Previous message: Jeffrey Turner: "Re: Help: Recursive String Length Function"
- Next in thread: Josh Sebastian: "Re: open file with arbitrary name"
- Reply: Josh Sebastian: "Re: open file with arbitrary name"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|