I think the problem is that you do not rewind the file after writing to it and reading it back. fgets() will read the file from current file position up to either the first 0 is encountered or the buffer has been filled up. Here is an example of how to make it work right.
Code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char* argv[])
{
char path[] = "myfile.txt";
char test[255] = {0};
FILE* auto_file = fopen(path, "a+");
if(auto_file == 0)
{
auto_file = fopen(path,"w");
fclose(auto_file);
auto_file = fopen(path, "a+");
}
fprintf(auto_file, "hello4");
rewind(auto_file);
fgets(test, 250, auto_file);
printf(test);
fclose(auto_file);
}