I'm currently writing a bunch of calculations in c using codeblocks and printing them off to the cmd prompt using the printf(); function. I am trying to create a graph from the data gathered. Is there a ways to get a hard copy or a text/doc file of all the data I printed out or better yet, is there a way to get all the values on the cmd prompt into a graph?
Why don't you just save them to a file?
Great example of writing to a file:
FILE *f = fopen("file.txt", "w");
if (f == NULL)
{
printf("Error opening file!\n");
exit(1);
}
/* print some text */
const char *text = "Write this to the file";
fprintf(f, "Some text: %s\n", text);
/* print integers and floats */
int i = 1;
float py = 3.1415927;
fprintf(f, "Integer: %d, float: %f\n", i, py);
/* printing single chatacters */
char c = 'A';
fprintf(f, "A character: %c\n", c);
fclose(f);
Another solution is just pipeing the output using > file.txt
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.