Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Import a binary file into VFP.
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00019096
Message ID:
00019233
Views:
40
>>> I need to import data from a binary file (*.PDB) >>> into a VFP DBF. FOPEN() returns a -1 which is >>> an error so I cannot do it this way. Any ideas? >> >I've never run into a problem with FOPEN either >until now. I have a file called phone1.pdb on >a diskette. I used lnFile = FOPEN("A:\PHONE1.PDB",10) >and also tried lnFile = FOPEN("A:\PHONE1.PDB") > >Both gave a -1 lnFile value which is an error. That's >why I posted the message. In VFP 5.0's help under >"binary", it says that a binary file can only be read >by the application that created it. > Just to compare apples and apples, I tried the PHONE1.PDB with VFP5 running under Windows 95. It opened the file fine and I was able to read data bytes. Problem is though that I can't figure out what format I need to read to make it conform to VFP standards. I did see the first entry that labelled a man a buyer for the U.S. Marine Corps. At least that gives you an idea of what I saw. Sample junk code I used: phfilhndl = FOPEN('PHONE1.PDB') IF phfilhndl > 0 ELSE ?? CHR(7) WAIT WINDOW "Too bad!! You didn't get to open it again. :)" RETURN ENDIF =FSEEK(phfilhndl,950) scanline = FGETS(phfilhndl) ? scanline RETURN You can copy & paste that into your Command Window and execute it. Make sure the file is in your default directory. The FGETS defaults to 254 on that particular line as proven by LEN(scanline). I tried longer lengths like FGETS(phfilhndl,512) but it didn't seem to matter as far as getting data with a pattern to it. Someone here mentioned it looked like a ProblemBuilder file (oh, I'm sorry, PowerBuilder). The PDB in PB are supposed to be compiled PBL files, I think. If it was compiled, that could take the patterns out of it that I'm looking for through some compression scheme. You may have better luck reading the source PBL file, if it's available. Sorry I couldn't help more. ==Carl
==Carl

Carl J. Warner
VFUG Officer

The early bird gets the worm, but the second mouse gets the cheese.
Previous
Reply
Map
View

Click here to load this message in the networking platform