|
Post by honky on Jun 29, 2024 12:01:37 GMT
Good morning, Var $ = "name" I would like to record open "données.txt" for append as #g
print #g, var$;" "; date$ But the date is on the next line. How to avoid? I tried Var$ = Var$+" "+Date$ print #g, var$
It's the same. Thank you for.
|
|
|
Post by plus on Jun 29, 2024 13:30:20 GMT
you need to treat date like a function with parenthesis, plus for some reason append was adding blank line maybe my mistake but this works
open "dons.txt" for append as #g V$ = "name "+Date$("yyyy/mm/dd") 'date is function needs () at least print #g, V$ close #g
open "dons.txt" for input as #g while eof(#g) = 0 input #g, var$ if var$ <> "" then print var$ : exit while wend close #g
b = b + ...
|
|
|
Post by honky on Jun 29, 2024 13:51:08 GMT
date$ is a string and it's calculated elsewhere with: mois$ = "Jan Fév Mar Avr Mai Jun Jui Aou Sep Oct Nov Déc" today$ = date$("mm/dd/yyyy") j = date$(today$) jsem$ = word$("Mar Mer Jeu x Ven Sam x Dim Lun",int((j/7-int(j/7))*10)+1) date$ = jsem$+" "+mid$(today$,4,2)+" "+word$(mois$, val(today$))
If I put: print#g, var$;" "; "HHH" It's same
|
|
|
Post by plus on Jun 29, 2024 14:16:33 GMT
this is working as expected for me open "dons.txt" for append as #g v$ = "name" print #g, v$;" ";date$() close #g
open "dons.txt" for input as #g while eof(#g) = 0 input #g, var$ if var$ <> "" then print var$ : exit while wend close #g
![](//storage.proboards.com/6923195/thumbnailer/hoqVrOwNADRy0HfkCEKZ.png) !!! make sure you delete the old test .txt file first or you will be showing only the first line of file over and over meanwhile your last printed line to file wont show!!! b = b + ...
|
|
|
Post by plus on Jun 29, 2024 14:28:59 GMT
date$ is a string and it's calculated elsewhere with: mois$ = "Jan Fév Mar Avr Mai Jun Jui Aou Sep Oct Nov Déc" today$ = date$("mm/dd/yyyy") j = date$(today$) jsem$ = word$("Mar Mer Jeu x Ven Sam x Dim Lun",int((j/7-int(j/7))*10)+1) date$ = jsem$+" "+mid$(today$,4,2)+" "+word$(mois$, val(today$))
If I put: print#g, var$;" "; "HHH" It's same
It's the same probably because you are reading the first line over and over, remember append adds to the file without deleting the previous lines. so delete the file before retesting with append or just use for input instead which overwrites the file each time. b = b + ...
|
|
|
Post by tsh73 on Jun 29, 2024 15:50:23 GMT
honky, please write what you got vs. what you want. Because "It's same" does not tell me a thing.
But I could do some guessing
Could new line be inside var$ variable? (as from reading from texteditor) try to change to
print #g,print trim$(var$);" "; date$
|
|
|
Post by honky on Jun 29, 2024 16:02:11 GMT
Var $ comes from a textbox. Your: print #g, print trim$(var $);" "; Date$ works very well, thank you tsh73.
|
|