Skip to content

Instantly share code, notes, and snippets.

@thebyrd
Created March 14, 2013 07:39
Show Gist options
  • Save thebyrd/5159545 to your computer and use it in GitHub Desktop.
Save thebyrd/5159545 to your computer and use it in GitHub Desktop.
How a Javascript Developer reads a file in C.
#include <stdio.h>
int main () {
FILE *file; file = fopen ( "app.c", "rt" );
int c; if (file) while ( ( c = getc(file) ) != EOF ) putchar(c);
file ? fclose(file) : printf("Error: Problem Reading File.\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment