Can you tell me how to pass a string to a file .txt? Thanks. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

Can you tell me how to pass a string to a file .txt? Thanks.

7th Jun 2017, 3:59 PM
Umbe
Umbe - avatar
5 Answers
+ 6
#include <fstream> int main (){ ofstream ofile ("test.txt") ofile << "Hello world\n"; ofile << "Writing in the file"; ofile.close (); }
7th Jun 2017, 4:03 PM
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender)
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender) - avatar
+ 8
oh thank you very much
8th Jun 2017, 12:01 AM
Umbe
Umbe - avatar
+ 5
What do you mean @Tobias?
26th Jun 2017, 6:20 PM
Umbe
Umbe - avatar
+ 3
Welcome
8th Jun 2017, 2:51 AM
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender)
เคฆเฅ‡เคตเฅ‡เค‚เคฆเฅเคฐ เคฎเคนเคพเคœเคจ (Devender) - avatar
- 1
You do the right thing and then u et the answer right but if I do the wrong thing, u get the answer wrong
26th Jun 2017, 11:57 AM
Tobias Teichman
Tobias Teichman - avatar