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

  1. C array subscript out of bounds and memory overflow difference
  2. C language uses Pointers to iterate over groups of numbers
  3. C language pointer and array difference
  4. C language pointer array and array pointer difference
  5. C language field pointer
  6. C function value passing and address passing
  7. C language function variable parameter
  8. C function pointer
  9. C language pointer function
  10. C language callback function callback
  11. Pragma once
  12. C language #include <> is different from #include
  13. C const decorates function arguments
  14. C const is different from define
  15. C # operator
  16. C language ## operator
  17. C language __VA_ARGS__
  18. C # # __VA_ARGS__
  19. C function variable length argument ##__VA_ARGS__ classic case
  20. C va_start/va_end/va_arg User-defined printf functions
  21. C main function
  22. Int argc, char *argv[]
  23. C language local variables
  24. C language global variables
  25. C language global variable and local variable difference
  26. The static C
  27. C language extern

C language file read and write fpuTC function

This article is published by the blog – Ape Say Programming Ape Say programming!