Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid seek offset while opening COM port with fopen

Status
Not open for further replies.

mshamz

Programmer
Apr 22, 2002
10
AE
Hi,

When I run the following code in VFP 6, it gives me 'Invalid seek offset' error.

MyCOMPort = "COM2"
MyHandle = fopen(MyCOMPort,12)

This code runs fine with VFP 3.

Can anyone help me on this ?


Thanx and Regards,

Shamz
mshamz@hotmail.com
 
This doesn't look like an error message which would be generated by the code you posted. Is there an fseek() in the code as well? And what service pack do you have on VFP 6? Finally, with the existance of COM and COM +, you might want to find another name for the file. Perhaps 'com2' has become a reserved word and VFP is getting confused. Dave Dardinger
 
The last time I saw that error,
The COM port was disabled in the BIOS.
David W. Grewe
Dave@internationalbid.com
 
Trying to open COM ports with low-level IO really isn't a good idea. While it may work in Win 95 / 98 / SE / ME, it most likely won't work in Win NT / 2000 / XP. Instead you should use the MSCOMM32 control - there are a number of Knowledgebase articles with VFP examples, not to mention those in the sample code provided with VFP.

Rick
 
Hi dgrewe,
I don't think this is a problem with the BIOS settings. Because when you run the command DIR > COM2, it prints on th COM port printer.

As I mentioned before, it could be a problem with Win95/98 and VFP6 combination. In Win2000 it is working fine.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top