newTIboyRob Posted August 3, 2023 Share Posted August 3, 2023 Hi all, I have a short program in basic that is just missing something, hopefully you can offer the fix. You will see it prints in columnar fashion, but am I looking for some kind of HTAB and or VTAB use to get it to print horizontally? Just can't get there: 5 HOME 10 FOR X=1 TO 4 20 READ N,F$ 30 PRINT N; " ";F$ 40 NEXT X 96 DATA 1, THIS IS FILE 1, 2, THIS IS FILE 2 97 DATA 3, THIS IS FILE 3, 4, THIS IS FILE 4 thus the [undesiired] output in 40 column: 1 THIS IS FILE 1 2 THIS IS FILE 2 3 THIS IS FILE 3 4 THIS IS FILE 4 ...and the desired output in 40 column: 1 THIS IS FILE 1 2 THIS IS FILE 2 3 THIS IS FILE 3 4 THIS IS FILE 4 Can you fix me please? Quote Link to comment Share on other sites More sharing options...
micheledipaola Posted August 3, 2023 Share Posted August 3, 2023 maybe add before the READ: HTAB LEN(STR$(N)) + 1 + LEN(F$) (and add here + 3 or whatever tab value you want between columns) I cannot test now and it has been ages since my last coding in AppleSoft, but it might work... or someone else will be better :D Quote Link to comment Share on other sites More sharing options...
newTIboyRob Posted August 3, 2023 Author Share Posted August 3, 2023 Thanks for the, ahem, INPUT, michele I tried that for a line 15, with adding + 3, but that yields: 1 THIS IS FILE 1 2 THIS IS FILE 2 3 THIS IS FILE 3 4 THIS IS FILE 4 ..not the desired goal of alternating. Do you have another tweak perhaps? Quote Link to comment Share on other sites More sharing options...
Iamgroot Posted August 4, 2023 Share Posted August 4, 2023 In Line #30, add a comma or a semi-colon as the last character after F$ Quote Link to comment Share on other sites More sharing options...
micheledipaola Posted August 4, 2023 Share Posted August 4, 2023 10 hours ago, newTIboyRob said: Thanks for the, ahem, INPUT, michele I tried that for a line 15, with adding + 3, but that yields: 1 THIS IS FILE 1 2 THIS IS FILE 2 3 THIS IS FILE 3 4 THIS IS FILE 4 ..not the desired goal of alternating. Do you have another tweak perhaps? Now I am remembering that there was a way to avoid changing line after a PRINT... but I forgot which one I will need to check it up! btw you are a couple characters short here anyway, so maybe that +3 should become a +5... but now I am not sure that's the easiest way - I would really need to remember that way to avoid the CR... Quote Link to comment Share on other sites More sharing options...
newTIboyRob Posted August 4, 2023 Author Share Posted August 4, 2023 Thanks Groot and Michele. I tried adding the comma, and that came very close to what I was looking for, and it may be the best I can get here. With the simple comma in there, I can even bypass the need for HTAB and LEN. Since the max characters of a file name can be 15, with 40 column, I am assured a nice bit of space horizontally (looks like about 8 spaces or so) inbetween 2 file names. I think I'll simplify the program even more and take the file numbers out and throwing some dummy file names in there instead, thus changing it now to: 5 HOME 10 FOR X=1 TO 4 20 READ F$ 30 PRINT F$, 40 NEXT X 96 DATA ACEY DUCEY, SNICKERS,HELLO,LASTOFTHEGREATS 40 col: ACEY DUCEY (8spcs) SNICKERS HELLO (8spcs) LASTOFTHEGREATS It's also cool how just that simple comma still put the LASTOFTHEGREATS directly underneath the SNICKERS. I never got the CAT function to do this alternating way for files, which is what I was originally looking for, but what I had tried in a new and different program: 10 PRINT CHR$(4);"CAT", just listed the files vertically the same way and ignored the comma spacing concept. I guess my simplified program is the closest I can get to having the CAT file list in alternating columns, to literally just take notes on paper of what the files are on the disk and plug 'em into READ DATA statements as above and do it that way. I guess that is the way around this. So I guess we got it now (unless I am mistaken about the CAT printing the files horizontally without putting the data into arrays) Thanks for your help! Quote Link to comment Share on other sites More sharing options...
newTIboyRob Posted August 4, 2023 Author Share Posted August 4, 2023 I remember Groot mentioning in another post that the CAT command by itself can't list files horizontally, so I am at the end of the line here with this concept, and we have the best solution now with this thread and my thread about lilsting files horizontally now, isn't that correct, Groot? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.