[Anjuta-list] ios::nocreate



I am using Anjuta 1.1.97 on a Slackware 9.0 Linux system and am having a problem
with the attached program.

I do not believe that this is an Anjuta problem but rather a problem with my
understanding of C++ therefore my question is where should I pose my problem,
rather than on this list ?

The line giving the problem is:-
inFile.open("./inData.txt", ios::nocreate);
The error I get is :-
main.cc 17 : 'nocreate' is not a member of type 'std::basic_ios<char

---

Regards,
Alf Stockton	www.stockton.co.za

The shortest distance between two points is under construction.
		-- Noelie Alito
/* Created by Anjuta version 1.1.97 */
/*	This file will not be overwritten */

#include <iostream>
#include <fstream>
using namespace std;

int main()
	{
	int x, y, z;
	int a, b, c;
	char ch;
	
	ifstream inFile;
	ofstream outFile;
	
	inFile.open("./inData.txt", ios::nocreate);	// See page 126/127 for nocreate
	outFile.open("./outData.dat");
	
	inFile>>x>>y;
	z = x + y;
	outFile<<"Sum of "<<x<<" and "<<y<<" = "<<z<<endl;
	inFile>>ch;
	outFile<<"The character that comes after "<<ch<<" in the ASCII set is B."<<endl;
	inFile>>a>>b;
	c = a * b;
	outFile<<"The product of "<<a<<" and "<<b<<" = "<<c<<endl;
	inFile.close();
	outFile.close();
	return 0;
	}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]