About 5,990,000 results
Open links in new tab
  1. Creating files in C++ - Stack Overflow

    Jan 25, 2009 · One way to do this is to create an instance of the ofstream class, and use it to write to your file. Here's a link to a website that has some example code, and some more information about the standard tools available with most implementations of C++:

  2. C++ program to create a text file, open and read a particular line

    Learn how to create a text file, open the text file and how to read a particular line from a text file in C++ by using the File handling concept.

  3. C++ Program to Create a File - GeeksforGeeks

    Sep 17, 2024 · Write a C++ program to create a file using file handling and check whether the file is created successfully or not. If a file is created successfully then it should print “File Created Successfully” otherwise should print some error message.

  4. C++ File handling: Create text file and write text - w3resource

    Apr 14, 2025 · Learn how to create a new text file and write text into it using C++ file handling. Enhance your programming skills with file manipulation in C++.

  5. C++ Files - W3Schools

    Create and Write To a File. To create a file, use either the ofstream or fstream class, and specify the name of the file. To write to the file, use the insertion operator (<<).

  6. How to read and write to a text file in C++? - Stack Overflow

    May 18, 2011 · if you want to use variable for a file name, instead of hardcoding it, use this: string file_name = "my_file.txt"; ifstream in2(file_name.c_str()); reading from file into variables (assume file has 2 int variables in): int num1,num2; in >> num1 >> num2; or, reading a line a time from file:

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

    Apr 28, 2018 · I want to create a text file and write to it. char filename[]="C:/k.txt"; FileStream *fs = new FileStream(filename, FileMode::Create, FileAccess::Write); fstream *fs =new fstream(filename,ios::out|ios::binary); fs->write("ghgh", 4); fs->close();

  8. C++ File Handling - Programiz

    File handling in C++ is a mechanism to create and perform read/write operations on a file. We can access various file handling methods in C++ by importing the <fstream> class. ifstream - to read from a file. ofstream - to create/open and write to a file. Note: Our online compiler cannot handle file handling right now.

  9. C++ program to create a file and write data to it - CodeVsColor

    C++ tutorial to how to create a file and how to write data to this file. We will learn how to use C++ ifstream library for file related operations.

  10. How to Write to a Text File in C++ - wikiHow Tech

    Jan 17, 2024 · This article illustrates the process of creating and writing to a text file in C++ using the Microsoft Visual Studio application on a Windows computer. The program utilizes the basics in the C++ language and will enable you to output any text to a Notepad file.

Refresh