lines: add null check after opening infile

This commit is contained in:
2026-07-02 09:37:13 +10:00
parent b826126635
commit a58f5db5a3

View File

@@ -21,6 +21,11 @@
int main(void)
{
FILE* infile = fopen("lines.txt", "r");
if (infile == NULL)
{
perror("Failed to open in.txt");
return 1;
}
char buf[SIZE];
while (fgets(buf, sizeof buf, infile) != NULL)