What do you want to save?
Add Code snippet
New code examples
-
C++ 2021-10-22 23:17:07
Reading From A File In C++
// reading a text file #include <iostream> #include <fstream> #include <string> using namespace std; int main () { string line; ifstream myfile ("example.txt"); if (myfile.is_open()) { while ( getline (myfile,line)... Add solution -
C++ 2021-10-14 17:11:14
c++ read file line by line
#include <iostream> #include <ifstream> #include <string> using namespace std; ifstream file("file.txt"); if (file.is_open()) { string line; while (getline(file, line)) { // note that the newline character is not i... Add solution -
SQL 2021-10-13 18:20:09
insert into mysql c++
#include <mysql.h> #include <iostream> #include <iomanip> #include <fstream> using namespace std; MYSQL *conn, mysql; MYSQL_RES *res; MYSQL_ROW row; int query_state; int main() { const char *server="students"; c... Add solution -
C++ 2021-10-05 12:07:05
write and read string binary file c++
#include <cstring> #include <iostream> #include <fstream> #include <string> struct player_data { std::string name; int score; }; int main() { std::ofstream savefile("score.dat", std::ios_base::binary); if(savef... Add solution -
C++ 2021-09-29 21:03:07
read char from text file c++
#include <iostream> #include <fstream> #include <vector> using std::cout; using std::cerr; using std::endl; using std::string; using std::ifstream; using std::vector; int main() { string filename("input.txt"); vector&... Add solution