Created
August 1, 2018 06:56
-
-
Save geekoff7/4e064f03172677603649c8947266de8b to your computer and use it in GitHub Desktop.
file pointer and file descriptor 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> | |
#include <stdlib.h> | |
#include <unistd.h> | |
int main(int argc, char const *argv[]) | |
{ | |
char str[] = "Hello World !!!"; | |
int fd = fileno(stdout); | |
FILE *fp = fdopen(fd, "w"); | |
fwrite(str, sizeof(char), sizeof(str), fp); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment