#include <stdio.h> #include <stdlib.h> #include <string.h> int main(){ FILE *fp1,*fp2; char ch; fp1=fopen("TEST.txt","w"); if(fp1==NULL) { printf("FILE can't be opened for writing"); exit(1); } printf("Enter characters to quit enter $"); do { ch=getchar(); if(ch!='$'); putc(ch,fp1); }while(ch!='$'); fclose(fp1); fp2=fopen("TEST.txt","r"); if(fp2==NULL) { printf("FIlE can't be opened for reading"); exit(1); } int charcount=0; while(!feof(fp2)) { ch=getc(fp2); printf("%c",ch); charcount++; } printf("\nCount of characters=%c\n",charcount); fclose(fp2); return 0; }
C:/TC/BIN/count_char_files.c:17: undefined reference to `_streams' C:\DOCUME~1\Arijit\LOCALS~1\Temp/cccFbaaa.o(.text+0x73):C:/TC/BIN/count_char_files.c:17: undefined reference to `_streams' C:\DOCUME~1\Arijit\LOCALS~1\Temp/cccFbaaa.o(.text+0x7b):C:/TC/BIN/count_char_files.c:17: undefined reference to `_streams' C:\DOCUME~1\Arijit\LOCALS~1\Temp/cccFbaaa.o(.text+0x81):C:/TC/BIN/count_char_files.c:17: undefined reference to `_streams' C:\DOCUME~1\Arijit\LOCALS~1\Temp/cccFbaaa.o(.text+0x90):C:/TC/BIN/count_char_files.c:17: undefined reference to `_streams' C:\DOCUME~1\Arijit\LOCALS~1\Temp/cccFbaaa.o(.text+0x95):C:/TC/BIN/count_char_files.c:17: undefined reference to `_fgetc' C:\DOCUME~1\Arijit\LOCALS~1\Temp/cccFbaaa.o(.text+0xcf):C:/TC/BIN/count_char_files.c:19: undefined reference to `_fputc' C:\DOCUME~1\Arijit\LOCALS~1\Temp/cccFbaaa.o(.text+0x154):C:/TC/BIN/count_char_files.c:31: undefined reference to `_fgetc' collect2: ld returned 1 exit status Execution terminated
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)