“Dateihandhabung” Code-Antworten

Dateihandhabung

// basic file operations
#include <iostream>
#include <fstream>
using namespace std;

int main () {
  ofstream myfile;
  myfile.open ("example.txt");
  myfile << "Writing this to a file.\n";
  myfile.close();
  return 0;
}
White Spoonbill

Python -Datei offen

#there are many modes you can open files in. r means read.
file = open('C:\Users\yourname\files\file.txt','r')
text = file.read()

#you can write a string to it, too!
file = open('C:\Users\yourname\files\file.txt','w')
file.write('This is a typical string')

#don't forget to close it afterwards!
file.close()
Dr. Hippo

Dateihandhabung

[file example.txt]
Writing this to a file.
Said HR

Ähnliche Antworten wie “Dateihandhabung”

Fragen ähnlich wie “Dateihandhabung”

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen