not callable error

bluphantom91 via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Nov 3 19:28:17 PDT 2016


Hello,

I am trying to finish up a group project but I am running into a 
small problem. I keep getting an error about fgetc not being 
callable. The purpose of my program is to count the number of 
characters in a file. Any bit of help is appreciated!

Here's my code:

import std.stdio;
import std.file;
import std.string;


void main()
{
	FILE *file;
	char ch;
	int charCount,wordCount,input;
	
	
	
	//File file = File("test.txt","w");
	 //input=fscanf(file, "%ch",&ch);
	
	 //file.writeln("hello");
	
	//string s = file.readln();
	
	file=fopen("test,txt","r");
	
	while(!file.eof())
	{
		/*string line = chomp(file.readln());
		wordCount++;
		writeln(wordCount);*/
		
		ch = getc(file);
		charCount++;
			
	}
	
	
	
	file.close();

		
	
	
}


More information about the Digitalmars-d-learn mailing list