Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MSComm Documentation
Message
From
30/09/2002 12:53:37
 
 
To
30/09/2002 12:14:10
James Hill
Jim Hill Productions
Halifax, Nova Scotia, Canada
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00705355
Message ID:
00705979
Views:
29
This message has been marked as the solution to the initial question of the thread.
Just check the VFP Help for FOPEN() and FGETS() - the examples there should give you 99% of what you need. Just one note - since your data is in CSV format, the first "record" or line returned from FGETS() will have your table field names. If you don't need them, just discard them.

Something like:
STORE FOPEN('yourfile.csv') TO gnFileHandle    && Open the file
IF gnFileHandle <= 0  && Is file open?
   WAIT WINDOW 'Unable to open file!' NOWAIT
ELSE  && Opened OK
   gcString = FGETS(gnFileHandle)  && should be your field names, use it or lose it
   DO WHILE !FEOF(gnFileHandle)
      gcstring = FGETS(gnFileHandle)  && get the next line
      Thisform.yourcommcontrol.output = gcstring  && and send it
   ENDDO
ENDIF
= FCLOSE(gnFileHandle)  && Close the file
UNTESTED.

>I've managed to copy the contents of the table to a CSV type but I am having problems coding the fopen/fgets. I should explain my ignorance. I am coming up on 76yrs and got interested VFP about 2 years ago.Prior to that I had done a quite a bit of programming in 2.5 and 2.6 for various film and TV projects I was producing. After I retired, VFP looked like keeping me off the streets and out of the bars - well at least for some the time. The project I am working on is for a charity Telethon. If you get me going again it'll speed things up considerably.
>TIA
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform