Click here to Skip to main content
15,913,939 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralChart Pin
8-Mar-01 0:18
suss8-Mar-01 0:18 
GeneralChart Pin
7-Mar-01 23:44
suss7-Mar-01 23:44 
GeneralChart Pin
7-Mar-01 23:29
suss7-Mar-01 23:29 
GeneralChart Pin
7-Mar-01 23:27
suss7-Mar-01 23:27 
GeneralChart Pin
7-Mar-01 23:23
suss7-Mar-01 23:23 
Generalfstream newbie, it's hurting Pin
7-Mar-01 22:04
suss7-Mar-01 22:04 
GeneralRe: fstream newbie, it's hurting Pin
markkuk7-Mar-01 23:44
markkuk7-Mar-01 23:44 
GeneralRe: fstream newbie, it's hurting Pin
8-Mar-01 2:54
suss8-Mar-01 2:54 
Thank you for pointing me the direction. I lookup MSDN and it causes more confusion regarding your comment about ios::nocreate isn't in the Std C++ library, It appears you are right as the compiler also has the same idea; I cut & paste part of MSDN on ifstream constructor ref, what confuses me is here it still says the 2nd paramater "nMode" can be ios::nocreate. May be it comes down to old and new lib again. I use this flag just because I don't want to create an empty file if the one I specify doesn't exist. Am I looking at the old stuff?. I don't really care but just want to use the fstream class instead of fopen(). This should not be an unreasonable wish,Frown | :(

////From MSDN
ifstream::ifstream
ifstream();

ifstream( const char* szName, int nMode = ios::in, int nProt = filebuf::openprot );

ifstream( filedesc fd );

ifstream( filedesc fd, char* pch, int nLength );

Parameters

szName

The name of the file to be opened during construction.

nMode

An integer that contains mode bits defined as ios enumerators that can be combined with the bitwise OR ( | ) operator. The nMode parameter must have one of the following values:

ios::in The file is opened for input (default).


ios::nocreate If the file does not already exist, the function fails.


ios::binary Opens the file in binary mode (the default is text mode).
Note that the ios::nocreate flag is necessary if you intend to test for the file’s existence (the usual case).
////End MSDN

I found from ios.h (really no idea about the old and new thing) that ios::nocreate is 0x20. I then tried "file.open("file.txt", 0x20 | ios:binary)" and it works??? but I should not need to do this. don't you agree?

I have included the angle brack on "fstream" but this paser just cut it out, so I used double quote here. Again, nothing works Confused | :confused:

Any idea??


Will

GeneralRe: fstream newbie, it's hurting Pin
Erik Funkenbusch8-Mar-01 11:31
Erik Funkenbusch8-Mar-01 11:31 
GeneralHD Partition programming... Pin
Ammar7-Mar-01 20:42
Ammar7-Mar-01 20:42 
Generalerror...-=.-=. Pin
hahyojin7-Mar-01 19:26
hahyojin7-Mar-01 19:26 
GeneralRe: error...-=.-=. Pin
l a u r e n7-Mar-01 22:23
l a u r e n7-Mar-01 22:23 
GeneralRealtime sound mixing Pin
wParam7-Mar-01 17:18
wParam7-Mar-01 17:18 
GeneralRe: Realtime sound mixing Pin
.::RockNix::.7-Mar-01 21:40
.::RockNix::.7-Mar-01 21:40 
GeneralRe: Realtime sound mixing Pin
7-Mar-01 21:53
suss7-Mar-01 21:53 
GeneralRe: Realtime sound mixing Pin
l a u r e n7-Mar-01 22:35
l a u r e n7-Mar-01 22:35 
GeneralAn SDI from a dialog based application Pin
j_had7-Mar-01 13:15
j_had7-Mar-01 13:15 
GeneralRe: An SDI from a dialog based application Pin
Christian Graus7-Mar-01 14:05
protectorChristian Graus7-Mar-01 14:05 
GeneralRe: An SDI from a dialog based application Pin
Masaaki Onishi7-Mar-01 15:12
Masaaki Onishi7-Mar-01 15:12 
GeneralRe: An SDI from a dialog based application Pin
Christian Graus7-Mar-01 19:26
protectorChristian Graus7-Mar-01 19:26 
GeneralRe: I doubt a little.... Pin
Masaaki Onishi8-Mar-01 3:47
Masaaki Onishi8-Mar-01 3:47 
GeneralDoubt me not, grasshopper :) Pin
Christian Graus8-Mar-01 9:09
protectorChristian Graus8-Mar-01 9:09 
GeneralRe: An SDI from a dialog based application Pin
j_had8-Mar-01 5:03
j_had8-Mar-01 5:03 
Questionhow to destroy dialog boxes Pin
7-Mar-01 10:48
suss7-Mar-01 10:48 
AnswerRe: how to destroy dialog boxes Pin
Christian Graus7-Mar-01 10:56
protectorChristian Graus7-Mar-01 10:56 

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.