The noreplace and nocreate flags are no longer part of the C++ standard
(not sure if they ever were part).
Essentially you have to check for the file's existence before trying to
open it and then attempt to open the file accordingly.
Noorez Kassam wrote:
> I marked the error with a comment.
>
> void Quiz::writeQuestion(Quiz ques, int type, char* quizName)
> {
> ofstream out_file(quizName,ios::noreplace); //compiler returns
> error that ios::noreplace doesn't exist.
>
> if(type == 1)
> {
> out_file << "#\n" << questionNumb << ". " << ques.question <<
> '\n';
> out_file << "A. " << ques.answerA << '\n';
> out_file << "B. " << ques.answerB << '\n';
> out_file << "C. " << ques.answerC << '\n';
> out_file << "D. " << ques.answerD << '\n';
> out_file << '#' << ques.actual << '\n';
> }
> if(type == 2)
> {
> out_file << "#\n" << questionNumb << ". " << ques.question <<
> '\n';
> out_file << "True or False\n";
> out_file << '#' << ques.actual << '\n';
> }
> }
>
> I marked the error with a comment.
>
> _________________________________________________________________
> MSN Premium helps eliminate e-mail viruses. Get 2 months FREE*
> http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=http://hotmail.com/enca&HL=Market_MSNIS_Taglines
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
> Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
> Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
> REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|