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.

Author
Message
logfor
22
Years of Service
User Offline
Joined: 17th Nov 2003
Location:
Posted: 17th Nov 2003 23:42
Hi alls !

For a project, I MUST read data file whose records are on the model :

" integer , float , string$ , ..... [carriage return] "

... and so on (80000 records !!)

With Visual Basic, this is very simple to read with the
"INPUT #1 integer,float,string$, ..." command )

But there is nothing like it in DBPro :-((

So, is there anyone who know how to make ??

Many, many thanks for any answer !!
CattleRustler
Retired Moderator
22
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 18th Nov 2003 00:06
if you are talking about vb6 LINE INPUT from a file# then yes there are plenty of things to use:

Quote: "
DIR : DIR
DRIVELIST : DRIVELIST
SET DIR : SET DIR Path$
MAKE FILE : MAKE FILE Filename
MAKE DIRECTORY : MAKE DIRECTORY Directory Name
DELETE FILE : DELETE FILE Filename
DELETE DIRECTORY : DELETE DIRECTORY Directory Name
COPY FILE : COPY FILE Source Filename, Destination Filename
MOVE FILE : MOVE FILE Source Filename, Destination Filename
RENAME FILE : RENAME FILE Source Filename, New Filename
EXECUTE FILE : EXECUTE FILE Filename, Commandline, Directory
FIND FIRST : FIND FIRST
FIND NEXT : FIND NEXT
CD : CD Path$
OPEN TO READ : OPEN TO READ File Number, Filename
OPEN TO WRITE : OPEN TO WRITE File Number, Filename
CLOSE FILE : CLOSE FILE File Number
READ BYTE : READ BYTE File Number, Variable
READ FILE : READ FILE File Number, Variable
READ DIRBLOCK : READ DIRBLOCK File Number, Folder to Read
READ FILEBLOCK : READ FILEBLOCK File Number, Filename to Read
READ FLOAT : READ FLOAT File Number, Variable
READ LONG : READ LONG File Number, Variable
READ MEMBLOCK : READ MEMBLOCK File Number, Memblock Number
READ STRING : READ STRING File Number, Variable String
READ WORD : READ WORD File Number, Variable
WRITE WORD : WRITE WORD File Number, Variable
WRITE BYTE : WRITE BYTE File Number, Variable
WRITE LONG : WRITE LONG File Number, Variable
WRITE DIRBLOCK : WRITE DIRBLOCK File Number, Folder to Create
WRITE FILEBLOCK : WRITE FILEBLOCK File Number, Filename to Create
WRITE FLOAT : WRITE FLOAT File Number, Variable
WRITE FILE : WRITE FILE File Number, Variable
WRITE MEMBLOCK : WRITE MEMBLOCK File Number, Memblock Number
WRITE STRING : WRITE STRING File Number, String
SKIP BYTES : SKIP BYTES File Number, Bytes To Skip
WRITE BYTE TO FILE : WRITE BYTE TO FILE Filename, Position, ByteValue
READ BYTE FROM FILE : Return Integer=READ BYTE FROM FILE(Filename, Position)
PERFORM CHECKLIST FOR DRIVES : PERFORM CHECKLIST FOR DRIVES
PERFORM CHECKLIST FOR FILES : PERFORM CHECKLIST FOR FILES
MAKE MEMBLOCK FROM FILE : MAKE MEMBLOCK FROM FILE Memblock Number, File Number
MAKE FILE FROM MEMBLOCK : MAKE FILE FROM MEMBLOCK File Number, Memblock Number
FILE EXIST : Return Integer=FILE EXIST(Filename)
PATH EXIST : Return Integer=PATH EXIST(Path String)
GET DIR$ : Return String=GET DIR$()
APPNAME$ : Return String=APPNAME$()
WINDIR$ : Return String=WINDIR$()
FILE END : Return Integer=FILE END(File Number)
FILE OPEN : Return Integer=FILE OPEN(File Number)
FILE SIZE : Return Integer=FILE SIZE(Filename)
GET FILE DATE$ : Return String=GET FILE DATE$()
GET FILE NAME$ : Return String=GET FILE NAME$()
GET FILE TYPE : Return Integer=GET FILE TYPE()
GET FILE CREATION$ : Return String=GET FILE CREATION$()"


This is the command list from dbp help regarding File Commands. You need to look there for a more in depth explaination.


-RUST-
logfor
22
Years of Service
User Offline
Joined: 17th Nov 2003
Location:
Posted: 18th Nov 2003 10:40
Thank for answer, but the VB6 command is not "line input # ", but: "input # ....",

So, this is example on VB6 manual :

record on file data : 123 "Hello" [carriage return]

program :

Dim MyString, MyNumber
Open "FILEDATA" For Input As #1
Do While Not EOF(1)
Input #1, MyNumber, MyString
Print " MyNumber = "; MyNumber;" MyString: ";MyString
Loop
Close #1

Result : MyNumber = 123 MyString: Hello

It is what I hope to make with DBP, without success. NB : I've tried all READ commands !!

Thanks for help )
Beta 1
22
Years of Service
User Offline
Joined: 27th Aug 2003
Location:
Posted: 18th Nov 2003 13:39
If its a text file someone posted code that reads a text file into a string - you can probably find it by searching.

Then you basically have comma and enter separated variables.

Use the string manipulation commands to extract each section and then parse the result using VAR to convert to numbers from text.
the_winch
23
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 18th Nov 2003 17:48
How difficult is it for you to generate the files again?
If db can't read floats written from vb then it might be easire to write the text files from vb so all the fields are strings. It would then be fairly easy to get db to read the files. Or you could work out how vb stores floats and integers in a file and write code in db that reads them correctly.

You can read a file in byte by byte in db so it is possible if you know the format of the file you are trying to read.

dbpro : p166mmx @ 233 : 256mb : sb 128pci : sis onboard

Login to post a reply

Server time is: 2026-07-26 20:16:40
Your offset time is: 2026-07-26 20:16:40