Doing it in code
Why don't you do it in the code of your program?
#include <stdio.h>
#include <stdlib.h>
// create a file pointer and the string to print to the file
FILE *fp;
char buffer[] = "This is my result string";
// open the file and exit() from stdlib.h if it does not exist
fp = fopen("results.txt","w");
if (fp == NULL) exit(1);
// print the string to the file
fprintf(fp,"result: %s", buffer);
// close the file to save the changes
fclose(fp);
return 0;