Segfaulting apparently when fgets is called a second time