IHYPRESS.NET
C
HOME | ASP | C | CSS | HTML | JAVASCRIPT | PERL | PHP | PYTHON | RUBY | SVG
Earn Free Bitcoin
CStrings ❯ Reading from a File
<08.03>
/* Reading a string from a file */
#include <stdio.h> #include <string.h> int main (void) { char sentence[200]; FILE *input; /* file is opened */ input = fopen("phrase.txt", "r"); /* the string is read from the file */ fgets (sentence, sizeof(sentence), input); /* sentence is echoed on the screen */ /* \" to display a " (double quotes) */ printf ("The sentence is:\n\"%s\"\n\n\n", sentence); /* file is closed */ fclose (input); return (0); }
Hergestellt in Deutschland / Made in Germany
The sentence is: "The quick brown fox."
COPYRIGHT © 2015-2024 IHYPRESS.NET. A DIVISION OF IHY PRESS. ALL RIGHTS RESERVED.