Help us and donate little Bitcoins to pay the server costs: 1AXLPuRUBYc1JczTW4XS65GL6oWjNP2Vt2

User Tools

Site Tools


Programming Reference/Librarys

Question & Answer

because of the inhumane working conditions at amazon in Germany, I will offer the Amazon app no more! (ARD Reportage)


    int fputc(int ch, FILE *stream); 

Writes ch, to stream stream. Returns ch, or EOF on error.

C Sourcecode Example

 * fputc example code
#include <stdio.h> /* including standard library */
//#include <windows.h> /* uncomment this for Windows */
int main( void )
  FILE *stream, *stream_target;
  char c;
  if((stream=fopen("test.txt","rb"))==NULL) {
    printf("Cannot open file.\n");
    return 1;
  if((stream_target=fopen("testcopy.txt","wb"))==NULL) {
     printf("Can't write to target\n");
     return 1;
  printf("copy file\n");
  while((c = fgetc(stream) ) != EOF) {
    fputc(c, stream_target);
  return 0;

test.txt content

test.txt - content

Test 1234

testcopy.txt content after copy

Test 1234

fputc output example

  output: ./fputc
  copy file
c/stdio.h/fputc.txt · Last modified: 2013/01/22 22:02 (external edit)

The new Question & Answer System is online and waiting for your Questions about Programming problems Impressum