Bifalgorithm post · Computer science one · Paths

How are files read, written, and properly managed?

How are files read, written, and properly managed? (Computer science one · Paths) — "Depending on the language, the act of opening a file may determine if it w…

Ideas in this flowchart

  • Gestion des fichiers selon le mode d’ouverture et le cycle de traitement
  • Le mode d’ouverture détermine si le fichier sera lu ou écrit
  • Un fichier lu est appelé fichier d’entrée
  • Un fichier écrit est appelé fichier de sortie
  • Les langages proposent différentes API ou fonctions pour lire, écrire ou ajouter du contenu
  • Un fichier peut être lu ligne par ligne jusqu’à atteindre sa fin
  • Un indicateur ou une valeur EOF signale que la fin du fichier est atteinte
  • Un fichier est une ressource qui doit être correctement gérée
  • Le fichier doit être fermé une fois son traitement terminé
  • L’absence de fermeture peut dépendre du langage et du système d’exploitation
  • Ne pas fermer le fichier peut entraîner la corruption des données
  • Même si le fichier est parfois fermé automatiquement à l’arrêt du programme, il est préférable de le fermer explicitement
Feed/

How are files read, written, and properly managed?

No cover

Channel

Computer science one

1 page

"Depending on the language, the act of opening a file may determine if it will be read from or written to. When read from, the file is referred to as an input file while a file that is written to is an output file. Languages may also have different API or functions to read/write or append to a file. A file may be read line by line until the end of the file has been reached. Languages usually support this by using a special End Of File (EOF) flag or value to indicate the end of a file has been reached. A file is a resource just like memory and we need to properly manage it. We need to make sure that we close a file once we are finished processing it. Depending on the language and other factors such as the operating system, failure to close a file may result in corrupted data. Though a file may be closed automatically for us when the program terminates, its still best practice to properly close it."

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.