From 3039a35fe5de77abc2e5de12d67cfeeba54fdebb Mon Sep 17 00:00:00 2001 From: Vichingo455 Date: Wed, 12 Mar 2025 09:47:37 +0000 Subject: [PATCH] Upload files to "file" --- file/prova_file.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 file/prova_file.cpp diff --git a/file/prova_file.cpp b/file/prova_file.cpp new file mode 100644 index 0000000..8b6b50d --- /dev/null +++ b/file/prova_file.cpp @@ -0,0 +1,23 @@ +/* +AUTORE: Manuel Vichi +Prova file +*/ +#include +#include +#include +#include +using namespace std; +int main(void){ + FILE *fp = fopen("file.txt","r"); + if (fp != NULL) { + int ch; + while((ch = fgetc(fp)) != EOF) + cout << (char)ch; +// cout << endl; + fclose(fp); + } else { + perror("Errore: "); + return 1; + } + return 0; +}