Posts: 6,419
Threads: 74
Joined: Mar 2002
Also, if you copy for example a file called "LongFileName.txt" from C: to D: from qbasic (opening "C:\LONGFI~1.TXT" for input and "D:\LONGFI~1.TXT" for output and stuff) the resulting file will lose its long filename, so it is better to avoid using QB built-in file functions when dealing with such files.
Posts: 1,956
Threads: 65
Joined: Jun 2003
Absolutely right, Nathan. Copying a file from drive to drive as well as to another directory, will cause the same problem. When you copy a file using Windows or from the DOS-Shell, even if you use the short filename, it still copies the long filename to the destination. Since QB cannot reference the long name, and Windows is not actually doing the copy, you'll end up with only the short name, like you said.
I suspect that there must be some assembly language function that could be called form QB to be able to handle long filenames. Maybe I'm dreaming.
*****
Posts: 6,419
Threads: 74
Joined: Mar 2002
Posts: 54
Threads: 16
Joined: Jan 2003
I tried something whitetiger suggested. Doesn't work. It says 'Bad file name'. I thought +'s were allowed here. Why not?
CHDIR "g:\onzin"
FOR i = 1 TO 5
OPEN "ding" + CHR$(i) + ".cot" FOR INPUT AS #1
OPEN "nieuw" + CHR$(i) + ".bla" FOR OUTPUT AS #2
DO UNTIL EOF(1)
LINE INPUT #1, info$
WRITE #2, info$
LOOP
CLOSE #2
CLOSE #1
NEXT i
PRINT "end of prog."
Posts: 6,419
Threads: 74
Joined: Mar 2002
Replace CHR$ by STR$.
CHR$(1) to CHR$(5) are weird control characters that aren't allowed in filenames. I guess you wanted 1 to 5 in your filename, use LTRIM$(STR$( instead of CHR$(.