About 743,000 results
Open links in new tab
  1. How to read and write to a text file in C++? - Stack Overflow

    Output streams act like sink to which you can write your data. To write your data to a stream, use << operator. ostream << my_variable; //This code will write a value from your variable into …

  2. Creating files in C++ - Stack Overflow

    Jan 25, 2009 · If you want to create a file with some content and don't need to deal with the ofstream after that you can simply write: #include <fstream> int main() { std::ofstream("file.txt") …

  3. c++ - How to write std::string to file? - Stack Overflow

    Mar 13, 2013 · I want to write a std::string variable I am accepting from the user to a file. I tried using the write() method and it writes to the file. But when I open the file I see boxes instead of …

  4. writing to a file using stream in C++ - Stack Overflow

    Mar 4, 2011 · I want to some text to output to a file. I heard that it is better to stream the data rather than creating a large string and outputing that. Presently I am creating a large string and …

  5. Create a text file and write to it in C++? - Stack Overflow

    Apr 28, 2018 · I am using Visual C++ 2008. I want to create a text file and write to it. char filename[]="C:/k.txt"; FileStream *fs = new FileStream(filename, FileMode::Create, …

  6. How to append text to a text file in C++? - Stack Overflow

    Dec 30, 2019 · but if we want to append text in the middle of file? with C style? using FILE *?? "a+" or "a" with fseek() and ftell() didn't worked for me – vincent thorpe Commented Mar 25, …

  7. fileoutputstream - Writing lines to .txt file c++ - Stack Overflow

    Nov 29, 2015 · For all you programmers out there! I'm trying to figure out why my program won't work. I'm stumped! I'm trying to write a program to open a text file named "CSC2134.TXT" for …

  8. Writing to file Visual C++ - Stack Overflow

    Aug 7, 2012 · There is a C++ style of writing though, in particular using std::string most of the time when you want to handle strings to store them, or streams to build them or write data in string …

  9. c++ - How to write vector values to a file - Stack Overflow

    The first is write all values to a string as they are calculated using stringstreams and later write the string to a file. The other method is to make a long string after the fact and write that to the file. …

  10. c++ - Creating/writing into a new file in Qt - Stack Overflow

    If I create a text file called Data in the directory, it remains empty. If I don't create anything it doesn't create the file either. I don't know what to do with this, this isn't the first way in which I …

Refresh