logoISU  

CS256 - Principles of Structured Design

Fall 2021

Displaying ./code/cs256su21code/jun30/writeStuff.c

/*

here, we're using getchar to write stuff from stdin to a file

*/

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[]){

    FILE *dst = fopen("output.txt", "w");

	int ch;
	while ( (ch = getchar()) != EOF ) {
  		fputc(ch, dst);
	}

	fclose(dst);


	return 0;
}