Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Open to Write / Open to Read command

Author
Message
cncfreak
21
Years of Service
User Offline
Joined: 29th May 2003
Location:
Posted: 29th Apr 2008 18:22
I was just wondering when you create a file with "Open to Write", is it possible to read this file into another program language? I'm not sure of the structure when the file is created and was wondering if it is proprietary to DB / DBpro?
cncfreak
21
Years of Service
User Offline
Joined: 29th May 2003
Location:
Posted: 29th Apr 2008 20:05
Hmm ok I was wondering because I looked at the example for "open to write" and it used "write file" so when I tried to look at the file created, it was garbled.
cncfreak
21
Years of Service
User Offline
Joined: 29th May 2003
Location:
Posted: 30th Apr 2008 00:26
I had another question. I read from a message thread back in 2003 that random access files weren't possible but in one of the DBpro books it was mentioned that is was possible. Before I go too far I just wanted to get confirmation that it was possible.

Thanks

Rob
jinzai
18
Years of Service
User Offline
Joined: 19th Aug 2006
Location: USA
Posted: 30th Apr 2008 09:45
The file you looked at was probably written as a binary file, and you were likely using a text application to view it. (Notepad, perhaps?)

Random access is not directly supported, and there is no built-in seek or even a concept of position that those things require. That doesn't mean you can't do it, just that you must use the most cumbersome methods to do it using the system provided. It is not at all worth it, unless you are simply skipping bytes....use something from a plug-in....IanM has quite alot of dedicated file I/O in many tasty flavours

You could also use the load dll facility to gain access to Windows, or even C file I/O because they have all the tools you could want, and are much faster, too. The dll kernel32.dll contains Windows file I/O, and the C file I/O is in msvcrt.dll Either one will do.

Login to post a reply

Server time is: 2024-11-25 03:56:36
Your offset time is: 2024-11-25 03:56:36