...
G_system("r.mapcalc < text_file");
...Such a line is 'ignored'.
There is no standard output from GRASS and no map is generated.
There are no errors in text_file, because it works in GRASS.
Have you tried specifying the full pathname for 'text_file'.
r.mapcalc shouldn't need one, I think.
Also, check the return status of G_system.
Martin