Created
August 25, 2024 08:02
-
-
Save mortymacs/0b99bfdc7cdc25e2da34bb866cab32c5 to your computer and use it in GitHub Desktop.
Temp file in C
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() | |
{ | |
char b[255]; | |
FILE *f; | |
f = tmpfile(); | |
fputs("hello mr dj", f); | |
rewind(f); //rewind to the beginning of the tmp file. | |
fgets(b, 255, f); | |
fputs(b, stdout); //or printf("%s\n", b); | |
fclose(f); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment