|
-
Jan 10th, 2001, 08:34 AM
#1
Thread Starter
Hyperactive Member
What is the code to create a file in a given folder? (ex: c:\myfiles\)
Thank you :::
-
Jan 10th, 2001, 08:39 AM
#2
Frenzied Member
Code:
Open FILENAME for Output As #1
Close #1
Or use the CreateFile (or OpenFile) api.
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Jan 10th, 2001, 10:23 AM
#3
PowerPoster
Other tahn Output, you also can open the as Append, Binary and Random. Juz depand on what and how you want to save the data into it.
Cheers!
-
Jan 10th, 2001, 10:30 AM
#4
Hyperactive Member
here's the code to write a txt if it helps, someone posted it here for me at one point, forget who but thanks:
Code:
'writing or reading data to or from a text file
'open for append adds the data to the end of file
'open for input opens the file for read only
'open for output opens the file and overwrites the file
'
'
Private Sub Command1_Click()
'this is the number of your file
Dim intFilenum As Integer
'set it to the next available free number
intFilenum = FreeFile
'this is your filename
Dim strFile As String
strFile = "A:\myfile.txt"
'this is the text you want to save (textbox)
Dim strText As String
strText = Text1.Text
'open the file for writing to as next freefile number
Open strFile For Append As intFilenum 'see above options
'write to the file
Write #intFilenum, strText 'to read use [input #filenum,strtext]
'close the file
Close intFilenum
End Sub
VB6.0 SP4
Windows 2000
I'm thinking of a number between
-
Jan 10th, 2001, 10:43 AM
#5
PowerPoster
PJB, You can do it without the FreeFile.
Code:
Open strFile For Append As #1
Print #1, strText
Close #1
-
Jan 10th, 2001, 10:57 AM
#6
Junior Member
Chris, you have a quarrel with FreeFile?
-
Jan 10th, 2001, 11:02 AM
#7
PowerPoster
Noop! Knut, Juz wish to let others know that it can be done with it. So we can declare less and make the code more efficient and a smaller EXE filesize.
Cheers!
Originally posted by Knut
Chris, you have a quarrel with FreeFile?
-
Jan 10th, 2001, 11:10 AM
#8
Junior Member
Just been asking since I believe yesterday or so you seemed to stress that as well...
I'm sort of in the habit of using FreeFile even though i rarely work with more than 6 or 7 files at the same time in my apps...
The older you get, the more you stick to habits even if there's no obvious need...
While becoming philosophical: Just because MS creates a function, that doesen't mean it has to be used!
(Now, there's a 180 degree turn...)
-
Jan 10th, 2001, 11:19 AM
#9
PowerPoster
Perhaps is no. 'coz we must always think that we can't
learn all the think in the world and we always learning new stuff from day to day.
Yet new things always improve the old things, else I don't
see there is a need to create a new thing without improving as compare to the old version.
Is there is a good things why we not give a try and why should it stick to the old and unefficient way? Hah...
-
Jan 10th, 2001, 11:32 AM
#10
Junior Member
Is there is a good things why we not give a try and why should it stick to the old and unefficient way? Hah...
That's the point!
-
Jan 10th, 2001, 11:50 AM
#11
Hyperactive Member
don't recall exactly saying it was the best, most efficient or only way of doing it, so whatever
VB6.0 SP4
Windows 2000
I'm thinking of a number between
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
|