import std.c.windows.windows; 	//Sleep
import std.c.stdio;				//printf
import std.stream;				//File:Stream


int main (char[][] args)
{
File iFile = new File;
	void PrintRest(bool withprint)
	{
		while (1)
		{
			try 
			{
			char c = iFile.getc();
				if (withprint)
					printf("%c", c);
			}
			catch (ReadError)
			{
				break;
			}
		}
	}
	if (args.length < 2) {
		printf("Usage: LogSpy FileName\n");
		getchar();
	}
	else
	{
	bool CouldNotOpenReported = false;
		while (1)
		{
			try
			{
				iFile.open(args[1], FileMode.In);
			}
			catch (OpenError)
			{
				if (!CouldNotOpenReported) {
					printf("Couldn't open %.*s\n", args[1]);
					CouldNotOpenReported = true;
				}
				Sleep(1000);
				continue;
			}
			break;
		}
		PrintRest(false);
		while (1)
		{
			PrintRest(true);
			Sleep(1000);
		}
	}
    return 0;
}
 