Small knowledge, big challenge! This paper is participating in theEssentials for programmers”Creative activities
directory
- Fputc function introduction
- Two. Fputc function use
- Guess you like it
C/C++ learning Directory >> C language basics
Fputc function introduction
The fputc function writes the character C to the position of the current write pointer to the file pointed to by the file pointer stream.
#include <stdio.h> #include <stdlib.h> /* * Character * [in] stream: file pointer handle * * Return value: ch is the character to be written, fp is the file pointer. EOF */ int fpuTC (int ch, FILE *stream) /* For example, fputc('a', fp); Or char ch = 'a'; fputc(ch, fp); * /Copy the code
Two. Fputc function use
/ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * / / / @ Author: programming ape said // @blog (personal Blog address): www.codersrc.com // @file :C language tutorial - C language File reading and writing fpuTC function // @motto: a small step without a thousand miles, a small stream without a river or sea, The wonderful program life needs to accumulate unremittingly! /******************************************************************************************/ #include <stdio.h> #include <string.h> int main() { char* s = "www.codersrc.com"; FILE* f = fopen("D:\\test.txt","w"); for(int i=0; i<strlen(s); i++) fputc(s[i],f); fclose(f); return 0; }Copy the code
Guess you like it
- C array subscript out of bounds and memory overflow difference
- C language uses Pointers to iterate over groups of numbers
- C language pointer and array difference
- C language pointer array and array pointer difference
- C language field pointer
- C function value passing and address passing
- C language function variable parameter
- C function pointer
- C language pointer function
- C language callback function callback
- Pragma once
- C language #include <> is different from #include
- C const decorates function arguments
- C const is different from define
- C # operator
- C language ## operator
- C language __VA_ARGS__
- C # # __VA_ARGS__
- C function variable length argument ##__VA_ARGS__ classic case
- C va_start/va_end/va_arg User-defined printf functions
- C main function
- Int argc, char *argv[]
- C language local variables
- C language global variables
- C language global variable and local variable difference
- The static C
- C language extern
C language file read and write fpuTC function
This article is published by the blog – Ape Say Programming Ape Say programming!