Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor to String
Message
From
24/09/2008 10:26:14
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01350079
Message ID:
01350192
Views:
30
>>UPDATE: Nevermind. I did a scan and built the variable that way. Not sure if it's the best, but it works.
>>
>>I have a cursor that I want to get the results into a memory variable. I'm trying this, but it returns an error that it cannot find the file. I thought using DBF() on an alias would return the physical table name. Or is it something different? Is there another way to do this? What I'm really looking for is a variable of the cursor where each row is on a separate line.
>>
>>m.Temp = FILETOSTR(DBF('ReportCursorSummary'))
>>
>
>That's weird. The FILETOSTR() command looked OK so I tried it myself and it worked fine. I see you found an alternative approach so probably no big deal. Maybe something to revisit at some point if performance of that code is an issue.

It may work or not, depending on whether Fox decides to actually create the file with the filename returned by dbf(). As we know, Fox is so fast simply because it manages to do so much in memory (and then has a few other tricks too). A cursor has a filename to it, but there's no guarantee that the file with that name will ever exist. It might.

If it does, the string retrieved like that, FILETOSTR(DBF('ReportCursorSummary')), will contain the dbf header, then one extra byte (containing a space or a "*", the deleted() mark) preceding each record and that's it. A chr(26) after the last record. The length of the header and length of each record can be retrieved, there are functions for that... so slicing this string into record strings is not hard... it's the binaries that will get you - anything memo, datetime, currency, integer, B type number (did I forget any?).

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform