Well, looking at the first code example - The first valid file location is 1 - not zero. You are trying to seek a location that does not exist. The second does the same.
[edit]Whoops! - Graythe wipes egg from chin[/edit]
[edit]Whoops! - Graythe wipes egg from chin[/edit]