Jump to content
IGNORED

tweak me, please


newTIboyRob

Recommended Posts

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?

 

 

 

Link to comment
Share on other sites

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?

                           

                            

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

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!

 

 

 

        

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...