47408Re: [LIBERTYBASIC] Dynamically naming files
- Mar 19, 2014Am 19.03.2014 21:45, schrieb Procyon:
>I think it would be something along the lines below.
> I have a program which produces a value from an operation on 2 integers
> m and n.
> I want to be able to save the results to different files based on this
> i.e. if m=5, n=3 and the result is 196, I want to print "5, 3" to the
> file '196.txt'
> In general I want to open a file who's name is based on the result
> integer, append the current value of m and n to the file, then close the
> I would be grateful for any help you could give.
> Many thanks
the code is not tested, but should give you a kick in the right direction.
'---code start (watch for line wraps)
m = 5
n = 3
result = ...
open str$(result) + ".txt" for output as #f
print #f, m; ", "; n
LB 4.04 Pro ... http://www.libertybasic.com/assist.html
LB 4.04 ....... http://www.libertybasic.com/lb404setup.exe
LB Community Wiki .............. http://basic.wikispaces.com/
LB Programmer's Encyclopedia ... http://lbpe.wikispaces.com/
LB Bug Tracker ................. http://libertybasicbugs.wikispaces.com/
Books at http://www.lulu.com/ and http://www.amazon.com/
Alyce Watson ... APIs for Liberty BASIC
Carl Gundel .... Beginning Programming with Liberty BASIC
Windows 7 Home Premium 64-bit SP1
AMD Turion X2 RM-70 2GHz, 4GB RAM
- << Previous post in topic