Click here to Skip to main content
15,914,071 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralUML-agrigations Pin
Starodubtsev Sergey8-Mar-01 1:39
Starodubtsev Sergey8-Mar-01 1:39 
GeneralUML-agrigations Pin
Starodubtsev Sergey8-Mar-01 1:39
Starodubtsev Sergey8-Mar-01 1:39 
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 
Hi,

I use VC 6 with SP4. CFile is nice but part of this project I can't use MFC. I also don't want to do fopen(), so I attempt C++ stream's way of life. But the unnecessary pain is ... to me as a 'iostream' newbie.

Two problems hurt most:

(1) I am working on a Dialog based project (with MFC support but my work is on a non-MFC utility type helper). Everything is going fine until I try to use the C++ file class to open a file for binary i/o. When I added the line #include "fstream.h" in the, say, MyDlgApp.cpp all hell breaks loose. The compiler gives me no end of complaints, over 100s, shouting error C2872: 'streambuf' : ambiguous symbol or 'ostream' : ambiguous symbol or 'ios' : ambiguous symbol etc. etc. That is before I even declare an open file stream object yet! This came just when I included the header!!

Not understand why, I created a new test Dialog application and entered #include <fstream.h> as I did before. This time everything is OK and I can even 'really' open a file. It seems something in my original app have broken. But what? and how to fix it?. Can someone help. It is driving me crazy.

(2) It is a real misery to me, I coded

ifstream in;
in.open("test.txt", ios::nocreate | ios::binary);
if (!in) { return 0;}

then the compiler shouted
error C2039: 'nocreate' : is not a member of 'basic_ios<char,struct std::char_traits<char=""> >'
error C2065: 'nocreate' : undeclared identifier

The misery to me is when I took away ios::nocreate (leaving ios::binary) then everything is OK again. I see both of these are defined as an enum in ios.h, so why one is accepted and the other not? Confused | :confused:

Am I doing something stupid here, or I should include something else as well. Your suggestion is greatly appreciated. Rose | [Rose]



WillConfused | :confused: Confused | :confused: Confused | :confused: Confused | :confused: Confused | :confused:
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 
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 

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.