Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9231671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T06:07:46+00:00 2026-06-18T06:07:46+00:00

This statement here doesn’t seem to be correct: Bidirectional file streams, on the other

  • 0

This statement here doesn’t seem to be correct:

Bidirectional file streams, on the other hand, do not have the flag
set implicitly. This is because a bidirectional stream
does not have to be in both input and output mode in all cases. You
might want to open a bidirectional stream for reading only or writing
only. Bidirectional file streams therefore have no implicit input or
output mode. You must always set a bidirectional file stream’s open
mode explicitly.

otherwise, this code wouldn’t compile.

#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    fstream file("novo.txt", ios::out);
    char i;
    file >> i;
} 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T06:07:47+00:00Added an answer on June 18, 2026 at 6:07 am

    Although there has historically been some confusion regarding this matter, I believe the statement you quoted is indeed misleading, but not for the reason in your example. Bidirectional file streams do set the flag implicitly, as noted in the documentation:

    void open(
    const char *_Filename,
    ios_base::openmode _Mode = ios_base::in | ios_base::out,
    int _Prot = (int)ios_base::_Openprot
    );
    

    Based on the Apache statement, I would NOT expect your code sample to fail, as it explicitly sets the flag to ::out. I would, on the other hand, expect this code to fail:

    int main()
    {
        fstream file("novo.txt");
        char i;
        file >> i;
    } 
    

    But based on the MSDN documentation, this code will not fail either, and the file will default to ios_base::in & out (and, hence, the Apache statement is not entirely accurate).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have seen this statement in many of the documention samples, like here This
I have this statement in my c program and I want to optimize. By
We have this statement: (SELECT res_bev.bev_id, property_value.name AS priority FROM res_bev, bev_property, property_value WHERE
I'm wondering if I can easily have an if statement somehow here: public Object[]
I am trying to run this update statement but informix doesn't allow me to.
I have this foreach statement that is supposed to cycle through an array, but
So I have this select statement that I am trying to make more responsive.
ok ... sort of have been dithering on posting this question but here goes:
I have this if statement that works on two different pages, however these two
Let's say that I have a sql script that looks like this: --split statement

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.