On Wed, Aug 26, 2026 at 07:15:00PM +0000, Jean-Christophe wrote:
> hello,
> 
> i try to write an my_files.txt
> 
> and see the output on tty

As Dan Ritter said in this thread: you are calling fonction_deux:

> bool fonction_deux (){
>       fstream my_file;
>       my_file.open("my_file.txt", ios::out);
>       if (!my_file) {
>               cout << "File not created!";

        ...and here, you are writing to stdout (what you call "tt", I think)

>       }
>       else {
>               cout << "File created successfully!\n" << endl;
>               cout << fonction_un() << endl;
> 
>       my_file.close();
>       }
>       var_fonction_deux = true;
>       return var_fonction_deux;
> }

and in all the other places too ("cout" writes to stdout).
If you want to write to your fstream my_file, which is
connected to "my_file.txt") you have to do something like

  my_file << "some text going to file" << endl;

(See https://www.w3schools.com/cpp/ref_fstream_fstream.asp for a more
complete example).

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature

Reply via email to