Recent Posts

Pages: 1 [2] 3 4 ... 10
11
QB64 Discussion / Re: SEEK # or not SEEK #
« Last post by SMcNeill on April 15, 2022, 02:47:14 pm »
The # is optional in the SEEK statement.

SEEK #52, 1

is the same thing as

SEEK 52, 1

Think of it as being similar to the LET statement.  :)



And Seek works for all our modes -- it just works differently in RANDOM.

Let's say I have a data file that looks like:

ABCDEFGHIJKLMNO

16 bytes in that data file, correct?  (A to O is the file)

Now, if we OPEN thatfile FOR Input, Output, or Binary....

SEEK thatfile, 3   <-- this just moved our file marker to being in front of the third byte -- the "C".

Now, if we OPEN thatfile FOR Random ...  LEN = 4

SEEK thatfile, 3   <-- this just moved the file marker to being in front of the third RECORD -- the "I".  (Since we set our record size as being 4 bytes.  Record 1 is ABCD.  Record 2 is EFGH.  The start of record three is before the "I".)

Seek, with Random files works by records.  With everything else, it works by byte position.
12
QB64 Discussion / Re: SEEK # or not SEEK #
« Last post by Dimster on April 15, 2022, 02:29:26 pm »
Thanks guys but I thought I could OPEN a file with data stored sequentially or even randomly with any file number I wanted. I will often store data multiple files with negative values or multiple files with positive values and the subsequent OPEN uses either an even number for the file for the positive data and an odd number for the negative data. I could for example OPEN file #33 and file #52 with no problems at all. The vast majority of the time the files are OPEN for INPUT and the subsequent INPUT #33 and INPUT #52 has worked without problems. I hadn't realized that the file number was an issue with a Seek statement.

I forgot about RANDOM. I don't work a lot with Random but when I did, I thought the data had to be stored as Random and then retrieved as Random. That being said however, I don't work a lot with Seek either but was pretty sure it should have worked with sequentially stored data and what I was trying to do was reset my Inputs back to the beginning of the file (Seek (1)) and then For Loop to the data I want to work with. But I gather Seek works only with Random??

The other thing that has me puzzled is the Seek statement itself. I believe I use to be able to write Seek #32, 1 but the wiki seems to have that 2nd Seek in the statement ..SEEK 32, SEEK(1) and it has dropped the use of the "#"
13
QB64 Discussion / Re: An introduction; A note on Wiki
« Last post by CharlieJV on April 15, 2022, 02:26:01 pm »
Welcome to the "QB64-forumhood", @dcromley !
14
QB64 Discussion / Re: An introduction; A note on Wiki
« Last post by SMcNeill on April 15, 2022, 01:26:05 pm »
Makes the whole sub static.
15
QB64 Discussion / Re: An introduction; A note on Wiki
« Last post by bplus on April 15, 2022, 01:12:37 pm »
So what does static do like that? Make all variables static?
16
QB64 Discussion / Re: An introduction; A note on Wiki
« Last post by SMcNeill on April 15, 2022, 01:01:59 pm »
Always glad to hear when someone enjoys any of my stuff.  Many thanks!  ;)
17
QB64 Discussion / Re: An introduction; A note on Wiki
« Last post by dcromley on April 15, 2022, 12:52:30 pm »
Yes -- Steve's got it.
And what a time to join (Steve's QB64 Bible is a joy!).
18
QB64 Discussion / Re: _FileExists not working with wildcards
« Last post by SMcNeill on April 15, 2022, 12:46:52 pm »
Really it's just one line of code? Why not that? Too easy!

Maybe you can ask the guy who suggested it to write you up a demo on how to do it?  ;D
19
InForm Discussion / First dabble with INFORM
« Last post by Cyberslog on April 15, 2022, 12:42:58 pm »
First program here using a Check Box and a Text Box, when it starts it looks correct when I check the box the text box displays "Hello World" but when I uncheck the box nothing changes....trying to figure out if I missed something...... a whole 2 lines of code added to the form. Using inform 1.3 build 20 and qb 2.02.

Sub __UI_ValueChanged (id As Long)
    Select Case id
        Case ClickTheBoxCB

            If ClickTheBoxCB.Value = -1 Then Text(TextBox1TB) = "Lonely World" else
            If ClickTheBoxCB.Value = 0 Then Text(TextBox1TB) = "Hello World"

    End Select
End Sub
20
QB64 Discussion / Re: An introduction; A note on Wiki
« Last post by SMcNeill on April 15, 2022, 12:42:18 pm »
Welcome @dcromley

Are you talking about static for the whole sub or all the variables in it?
Was this something in earlier QB?

I know you can have Static variables in a Sub but I don't think that's what you mean.

There's no mention of STATIC for the SUB itself:  https://wiki.qb64.org/wiki/SUB

Code: QB64: [Select]
  1. For i = 1 To 5
  2.     foo
  3.  
  4.     x = x + 1
  5.     Print x

Such as the above...
Pages: 1 [2] 3 4 ... 10