Trouble creating a shell in C (Seg-Fault and ferror)
问题 I have been following a tutorial on how to make my own shell but I have been stuck for a couple days now. Two things: When this code is compiled and ran, it will randomly have segmentation faults and I cannot figure out why. The if statement `if (ferror != 0)` always seems to be true. which is odd because I do not understand why fgets() is failing in the main() function. Any information on these topics (or other topics about creating this shell) would be greatly appreciated. #include <stdio.h