|
-
Sep 24th, 2001, 03:13 AM
#1
Thread Starter
Hyperactive Member
fancy file stuff
Any one know how to read a file as input and how to store the contents of the file.
does each line get stored as a string in an array of strings??
-
Sep 24th, 2001, 03:50 AM
#2
Fanatic Member
If you want to open a text only file use...
Code:
Dim Str as String
Open "C:\myfile.txt" for input as #1 'myfile.txt=the text file
'To get all the text into a string
Input #1, Str
'To get by charectors into a string
Str=Input(NumberOfChars, #1)
#1=file number... hence it can go on as #2, #3, #4 etc, depending on the number of files you are opening
To open in binary mode use... (Required for exe,dll,com etc files)
Code:
Dim Str as String
Open "C:\myfile.txt" for binary as #1 'myfile.txt=the text file
Str=Space(FileLen("C:\myfile.txt"))
Get #1,,Str
THE TIME/WEATHER IS 
Don't know how to use APIs or have problem with them,
Download API-Guide & API-Viewer from http://www.allapi.net
-
Sep 24th, 2001, 03:55 AM
#3
Thread Starter
Hyperactive Member
cheers, I'll give it a whirl!
-
Sep 24th, 2001, 03:59 AM
#4
http://www.vbforums.com/showthread.p...open+and+input
No, it gets stored in a single string variable in the examples on the above page. If you wanted this into an array of strings, you could use something like :
Split(strFileStringVariable, Chr(13))
The split function splits a string into an array of strings, the new array elements are created whenever a new line (chr(13)) is found within that string variable.
-
Sep 24th, 2001, 04:03 AM
#5
Thread Starter
Hyperactive Member
cheers, Alex!
do you know anything about obtaining modem properties with VB!
-
Sep 24th, 2001, 04:33 AM
#6
A lot of the Com port & modem talking / checking etc is either done with the winsock control (which I've never used before myself). Or the API.
If you go to www.allapi.com and download the toolshed, you can do a search from the file menu for all API calls which have something to do with modems. Samples for each API call are included (fantastic program).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|