Re: How to use file_num = open ( "file", "mode" )
- Posted by jiri babor <jbabor at PARADISE.NET.NZ> Aug 12, 2000
- 458 views
cense just wrote: >here try something like this: > >-- untested code > >include get.e > >atom fn >sequence full_path, drive, file > >puts(1, "enter drive letter: ") >drive = gets(0) -- get the drive letter in a sequence >puts(1, "enter file name: ") >file = gets(0) -- get the file name in a sequence > >full_path = append( drive, ":\\") -- append the ":\\" to the end of the drive >full_path = append( full_path, file ) -- app the file name to the drive letter > -- and ":\\" > >fn = open( full_path, "w" ) > -- do your stuff >close(fn) > >hope that helps ( or even works! ) > >-- >cense No, it does not help, because it does not work! It takes only about 30 seconds to test it, if it works. If it does not, it usually takes a bit longer, but it saves you a lot of embarrassment and you do not confuse the poor newbie even more. jiri include get.e atom fn sequence full_path, drive, file puts(1, "Enter drive letter: ") drive = gets(0) -- get the drive letter in a sequence drive = drive[1..1] -- strip newline puts(1, "\nEnter file name: ") file = gets(0) -- get the file name in a sequence file = file[1..length(file)-1] -- strip newline full_path = drive & ":\\" & file -- concatenate fn = open( full_path, "w" ) -- do your stuff close(fn)