Posted: Fri May 17, 2002 11:24 am
Restored from previous forum. Originally posted by willinyork.
hi (again!)
In my program I write a textfile containing a line of filenames seperated by one space between each filename. I then want to go through the file and output each filename to an indiviual textfile.
the code I have is like this:
position=0
filenumber=1
ReadFile(1,"c:\aiff2vagscript.txt")
FileSeek(position)
wavfiles$=ReadString()
CloseFile(1)
;above to read the contents of the file into a string called wavfiles$
While filenumber<(num+1)
positionofaif=FindString(wavfiles$,".aif",position)
newwavfiles$=Mid(wavfiles$,position,positionofaif+4)
CreateFile(2,"c:\testoutput"+Str(filenumber)+".txt")
WriteString(newwavfiles$)
CloseFile(2)
newwavefiles$=""
position=positionofaif+5
filenumber=filenumber+1
Wend
It SEEMS to work fine - however, if wavfiles$ = "file1.aif file2.aif file3.aif " then the three indiviual textfiles created are ALMOST correct - the first one contains just "file1.aif" the thrid one contains just "file3.aif" but the second one contains "file2.aif file3.aif" and I can't work out why it does this! Also, it seems to mess up if I use more filenames in the wavfiles$ string. Any advice appreciated! Thank you
(You lot are very good to me!)
hi (again!)
In my program I write a textfile containing a line of filenames seperated by one space between each filename. I then want to go through the file and output each filename to an indiviual textfile.
the code I have is like this:
position=0
filenumber=1
ReadFile(1,"c:\aiff2vagscript.txt")
FileSeek(position)
wavfiles$=ReadString()
CloseFile(1)
;above to read the contents of the file into a string called wavfiles$
While filenumber<(num+1)
positionofaif=FindString(wavfiles$,".aif",position)
newwavfiles$=Mid(wavfiles$,position,positionofaif+4)
CreateFile(2,"c:\testoutput"+Str(filenumber)+".txt")
WriteString(newwavfiles$)
CloseFile(2)
newwavefiles$=""
position=positionofaif+5
filenumber=filenumber+1
Wend
It SEEMS to work fine - however, if wavfiles$ = "file1.aif file2.aif file3.aif " then the three indiviual textfiles created are ALMOST correct - the first one contains just "file1.aif" the thrid one contains just "file3.aif" but the second one contains "file2.aif file3.aif" and I can't work out why it does this! Also, it seems to mess up if I use more filenames in the wavfiles$ string. Any advice appreciated! Thank you