Jill ---
There are two potential problems at work here. The first is that it may be possible that there is a carraige-return (CHR(13)) as the first character of the second line....the second problem may be that there is a Ctrl-Z (CHR(26)) at the end of the first line.
>I'm extremely new at VFP, and coding in general. I'm having trouble with fgets(). I'm trying to read a .dat file line by line. Each line is 306 characters. My problem is that the fgets() only reads the first line, 306 characters. When it gets to the second line, it thinks that it is 0 characters. Here is some of my code..any help would be greatly appreciated! Thanks in advance, Jill
>
>lfilehandle=fopen(thisform.examfile, 0)
> if (lfilehandle != -1)
> Do while !FEOF(lfilehandle)
> examstring=fgets(lfilehandle, 306)
> wait window str(LEN(examstring))
> if(LEN(examstring) < 2)
> EXIT
> else
> insert into.....and so on
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05