#include <stdio.h>
#include <windows.h>

bool CouldntOpenReported = false;
int main(int argc, char ** argv)
{
	if (argc < 2)
	{
		printf("Usage LogSpy FileName\n");
		getchar();
	}
	else
	{
		while (1)
		{
			FILE *f = fopen(argv[1], "rb");
			if (!f)
			{
				if (!CouldntOpenReported)
				{
					printf("Couldn't open %s\n", argv[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);
						if (c == EOF)
							break;
						putchar(c);
					}
					Sleep(1000);
				}
			}
		}
	}
	return 0;
}