hello,

i try to write an my_files.txt

and see the output on tty

i see on tty, but no write my_files.txt


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

bool var_fonction_un = false;
bool var_fonction_deux = false;

int age=25;
int bd=100;


bool fonction_un() {
        cout << "chocolat" << endl;;
        cout << "chocolat " << age << "ans" << endl;
        cout << "chocolat a environ " << bd << " bandes-dessinées." <<
endl;
        
        var_fonction_un = true; 
        return var_fonction_un;
}

bool fonction_deux (){
        fstream my_file;
        my_file.open("my_file.txt", ios::out);
        if (!my_file) {
                cout << "File not created!";
        }
        else {
                cout << "File created successfully!\n" << endl;
                cout << fonction_un() << endl;

        my_file.close();
        }
        var_fonction_deux = true;
        return var_fonction_deux;
}

int main() {
        fonction_deux();        

        return 0 ;
}

--

https://bpa.st/3PM5U <-- work

Anyone know why my program doesn't write my_file.txt?


-- 
-- 
Evolution as taught in public schools is, like religion, based on
faith, not science.
--
Only our present actions define our future...

Reply via email to