Output to file on disk in windows 10
-
- Posts: 2
- Joined: Sep 17, 2020 17:07
Output to file on disk in windows 10
Print and print#1 or print#2 etc all output to screen in stead off diskfile, what's wrong?
Re: Output to file on disk in windows 10
If you post your code, we might be able to help you more easily. As it is, there is not enough info to give you a definitive answer.
Re: Output to file on disk in windows 10
An example use:
For more info see: Wiki: (PRINT | ?) #
Code: Select all
dim as string fileName1 = "test_file_1.txt"
dim as string fileName2 = "test_file_2.txt"
if open(fileName1 for output as #1) <> 0 then
print "Error opening: " & fileName1
end 'closes all open files as well
else
print "File created: " & fileName1
end if
if open(fileName2 for output as #2) <> 0 then
print "Error opening: " & fileName2
end 'closes all open files as well
else
print "File created: " & fileName2
end if
print #1, "Test 111"
close #1
print #2, "Test 222"
close #2
end 'closes all open files as well
Re: Output to file on disk in windows 10
Hello Kees van Dongen.
Choose the "POST REPLY" button bottom left of page to respond.
The "Report Post" Button is for something else - you don't want that one.
Choose the "POST REPLY" button bottom left of page to respond.
The "Report Post" Button is for something else - you don't want that one.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: Output to file on disk in windows 10
There must be a space between print and the file number !Kees van Dongen wrote:print#1 or print#2 etc all output to screen ...
wrong:
Code: Select all
print#1
print#2
sleep
Code: Select all
print #1,your_data_or_var
print #2,your_data_or_var
print#1 outputs "1"
print#2 outputs "2"
you can interpret it as fbc print the file number "1" and "2" but for me it looks like a tiny parsing bug ?
Joshy
-
- Posts: 2
- Joined: Sep 17, 2020 17:07
Re: Output to file on disk in windows 10
Thanks to all, it was a mistake of a former life with PB. A space was the problem.