Get the App
SLTechnology News&Howtos  ›  Servers  › 

File and stream-- fopen/fclose

Shulou Source: shulou.com Published: 2022-06-02 17:44:14 09月22日 Update

# include

Int main (void)

{

FILE* fp = NULL

Fp = fopen ("abc.txt", "a +"); / / fopen (path, mode) calls the file abc.txtif (NULL = = fp) {printf ("fopen fail\ r\ n"); perror (");} else {fwrite (" hello filestream! ", 1,17, fp) / / fwrite (const char* string, size_t size, size_t nmem, fp) writes the string pointed by string to the file pointed to by fp. The size of a single write is size, and a total of nmem size uppercase content is written to fclose (fp);} return 0

}

Tags: File content point single uppercase size character string method Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Xiaomi Shulou Tech Info MySQL Shulou Information