import std.c.windows.windows; 	//Sleep
import std.c.stdio;				//printf

bool CouldntOpenReported = false;

int main(char [][] args)
{
	if (args.length < 2)
	{
		printf("Usage LogSpy FileName\n");
		getchar();
	}
	else
	{
		while (1)
		{
			FILE *f = fopen(args[1], "rb");
			if (!f)
			{
				if (!CouldntOpenReported)
				{
					printf("Couldn't open %.*s\n", args[1]);
					CouldntOpenReported = true;
				}
				Sleep(1000);
			}
			else
			{
			int c;
				if (!CouldntOpenReported)
				{
					while (1)
					{
						c = fgetc(f);
						if (c == EOF)
							break;
					}
				}
				while (1)
				{
					while (1)
					{
						c = fgetc(f);
						printf("%d\n", (int)c);
						if (c == EOF)
							break;
						putchar(c);
					}
					Sleep(1000);
				}
			}
		}
	}
	return 0;
}