Just wondering if anyone has an idea how to do this, i've created a simple program to read line and word counts from a text file in C. The program asks what file you would like to read from and continues from there, my problem is if i enter a file that doesn't exist it seg faults.
Does anyone know a way to test if a file name a user inputs exists using only stdio.h before it tries to open it?
Does anyone know a way to test if a file name a user inputs exists using only stdio.h before it tries to open it?