Hello,

I have write with the old language c to read file but the function feof have a problem. When the file is finished to be read feof crash with an error E1513. Could you tell me what's wrong djfeeler thank you in advance.

My code :

Code:
#include <acknex.h>
#include <stdio.h>

function main()
{
	FILE* file = NULL;
	int character = 0;
	
	file = fopen("text.txt","r");
	
	if(file != NULL)
	{
		character = fgetc(file); // init the current character
		
		while(!feof(file)) // continue until the end of the file
		{
			printf("%c",character); // display the character
			character = fgetc(file); // read the next character
			
			if(ferror(file))
				printf("Error in file !");
		}
		
		file_close(file);
	}
	else
	{
		printf("can't open the file !");
	}
}



Last edited by djfeeler; 01/08/12 22:48.