What do you want to save?
Add Code snippet
New code examples
-
PHP 2021-11-07 12:52:12
appending txt file from php
// LOCK_EX will prevent anyone else writing to the file at the same time // PHP_EOL will add linebreak after each line $txt = "data-to-add"; $myfile = file_put_contents('logs.txt', $txt.PHP_EOL , FILE_APPEND | LOCK_EX); // Second option is this... Add solution -
C++ 2021-11-01 20:15:14
opening 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-28 10:43:11
How to read a file in in C++
// io/read-file-sum.cpp - Read integers from file and print sum. // Fred Swartz 2003-08-20 #include <iostream> #include <iomanip> #include <fstream> using namespace std; int main() { int sum = 0; int x; ifstream inFile; ... Add solution -
C 2021-10-25 03:17:10
how to create a file in c
/** * C program to create a file and write data into file. */ #include <stdio.h> #include <stdlib.h> #define DATA_SIZE 1000 int main() { /* Variable to store user content */ char data[DATA_SIZE]; /* File pointer to hold refer... Add solution -
C 2021-10-23 00:43:09
what is fprintf in c
#include<stdio.h> int main() { int i, x = 4; char s[20]; FILE *f = fopen("new.txt", "w"); if (f == NULL) { printf("Could not open file"); &... Add solution -
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
Best helpers
Ranking is empty