Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open #1 for Input(?), Append(?), or what(?)

Status
Not open for further replies.

TudorSmith

Programmer
Jan 14, 2002
245
0
0
GB
In my "Discography" application, the user selects a track from a list box, and the app plays the related MP3 file using a MediaPlayer control on the form. The MediaPlayer knows where the MP3 is located...cause I've hardcoded the path to read the D:\ drive.

Oops...silly me, I just realized some folks have two CD players (D:\ & E:\).

Perhaps I could store the details in a txt file (pretty much like a database), such that I can now have a menu option that allows the user to define their chosen location for the MP3 files. So that when the app is next opened, it interrogates the "Settings.txt" file, reads the location that the MP3's are stored, and always looks there for the files.

Q:, how do I use the "Open #1 for..." coding to actually amend a line in a file?

So....

d:\audio, Default Location

Would be changed to c:\program files\audio if the user changed the settings?

Any suggestions would be welcome


birklea birklea ~©¿©~ <><
I know what I know...don't presume that I know what I don't! Smithism!!!
 
Check out the built-in SaveSetting and GetSetting functions, which are there to allow you to do precisely this sort of thing.
 
'to add a file to the filelist.txt if the user changes
if userchange=true then
Open &quot;c:\program files\audio&quot; For Append As #1
Print #1, strFilename
Close #1
load strFilename
else
'to load a file the user selects
open &quot;D:\audio,default location&quot; for input as #2
do while not eof(2)
line input#2,strFilename
if strFilename = strUserSelection then
close #2
load strFilename
exit do
end if
loop
end if

logically this works, havent tried it just deskchecked it
strFilename would be the filename your are loading
let me know if this helps!!! DGatton@ev1.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top