Hi,
When I run the following code from Code::Blocks it runs as expected, however if I run it from Terminal in Ubuntu it fails. What can I do?
The code taken from Internet with some modification:
// Template Hello World 4
#include <stdio.h>
#include <stdlib.h>
void simple_err(const char *const str)
{
fprintf(stderr,"%s\n",str);
exit (EXIT_FAILURE);
}
int main (void)
{
FILE *fp;
fp = fopen ("input_file.text","r");
if (fp == NULL)
simple_err("Problem opening file.");
fclose (fp);
printf ("File opened okay\n");
return EXIT_SUCCESS;
}