Search found 1023 matches

by jevans4949
Jun 11, 2017 17:29
Forum: Beginners
Topic: Terrible Bugs
Replies: 13
Views: 1438

Re: Terrible Bugs

@sancho2: You are correct in saying you can't PUT a string array. It's a long time since I tried it. You can put a TYPE containing variable string descriptors; you get a warning from the compiler if you do, but it still runs. And as you illustrated, If you want to emit the actual data, you have to ...
by jevans4949
Jun 10, 2017 9:16
Forum: Beginners
Topic: Terrible Bugs
Replies: 13
Views: 1438

Re: Terrible Bugs

@owen: In the normal course of events, for the sake of speed, FreeBasic doesn't check that array subscripts are in the valid range, so your last example will stomp over memory in an unpredicatble way. EDIT: you may get a segment violation error at runtime if you try to write outside outside the mem...
by jevans4949
Jun 10, 2017 0:03
Forum: Beginners
Topic: Terrible Bugs
Replies: 13
Views: 1438

Re: Terrible Bugs

@owen: The array descriptor (a data type internal to the compiler, includes a "virtual origin", which is a pointer to the theoretical address of array(0,0,0). To simplify, if you put "DIM X (2 TO 4) AS INTEGER", and the compiler allocates 12 bytes for the content at &HC000, ...
by jevans4949
Jun 07, 2017 9:33
Forum: Beginners
Topic: uInteger
Replies: 9
Views: 931

Re: uInteger

@HillbillyGeek: Also note that if you set up a loop in the form: Dim u as ubyte For u = 0 to 255 'Whatwever Next u ... the loop will never end. At the end of each iteration, 1 is added to u, and after 255 it rolls over to 0, and starts all over again. There are ways round this. Most obvious is to p...
by jevans4949
Jun 07, 2017 9:20
Forum: Beginners
Topic: Terrible Bugs
Replies: 13
Views: 1438

Re: Terrible Bugs

1. Initialise i to 3 (or some value) before using it to DIM arrays.
2. Use REDIM to define your arrays with dynamic sizes.
by jevans4949
May 24, 2017 19:44
Forum: Beginners
Topic: Saving output to a file
Replies: 11
Views: 1434

Re: Saving output to a file

That is not safe coding of imposing a file number (as #94) to bind to a disk file (with OPEN, PRINT #, ...). The better is to request a file number to the system (just before the 'OPEN' code line), by using the keyword FREEFILE : dim as integer f = freefile open "answers.txt" for output a...
by jevans4949
May 20, 2017 17:52
Forum: Beginners
Topic: Saving output to a file
Replies: 11
Views: 1434

Re: Saving output to a file

If it's just plain text output, you could modify your program to print the results you need to a .txt file, which you could print either from Notepad or FBEdit, or paste the content into your word processor. open "answers.txt" for output as #94 print #94,"my answer" close #94
by jevans4949
May 05, 2017 16:16
Forum: Beginners
Topic: Can functions return arrays?
Replies: 40
Views: 3313

Re: Can functions return arrays?

@evil_twin: In case it's what you need to do, you can declare a dynamic array using ReDim, and resize it in your function using ReDim again. Trival demo: Sub resizer(hisarray()As integer) ReDim hisarray(0 To 99) hisarray(99) = 42 End Sub reDim myarray(0) As Integer resizer(myarray()) Print LBound(my...
by jevans4949
Apr 22, 2017 11:07
Forum: Community Discussion
Topic: ROM BASIC replacement?
Replies: 8
Views: 1580

Re: ROM BASIC replacement?

One would probably be better off starting with a free basic (not FreeBasic) interpreter, rather than a compiler. I did google this the other day, and found there are quite a few open source ones. Although I didn't bother looking into them. You then have to decide what to do about the quirks of each ...
by jevans4949
Apr 17, 2017 18:02
Forum: General
Topic: Problem with print# under FLTK? [SOLVED]
Replies: 2
Views: 528

Re: Problem with print# under FLTK?

@D.J.Peters: Thanks to your post in the Libraries board concerning the necessity of callback functions needing to be defined as cdecl, I amended my program, and the problem has gone away.

Many thanks.
by jevans4949
Apr 17, 2017 10:19
Forum: Libraries
Topic: FLTK-C-1.3.3 for FreeBASIC
Replies: 393
Views: 89288

Re: FLTK C for FreeBASIC Jan 09, 2017

@D.J.Peters: Thanks for your corrections. The significance of the Cdecl had passed me by, and the BoxType function.

I have corrected these, and re-loaded to Google Drive.
by jevans4949
Apr 14, 2017 21:47
Forum: General
Topic: Problem with print# under FLTK? [SOLVED]
Replies: 2
Views: 528

Problem with print# under FLTK? [SOLVED]

Writing a file analyser program under FLTK. To make life simpler (I thought), I decided to send the output to a Freebasic file, using Open ... As #2, Print #2, Close #2 in a callback routine run on a button push. It all works OK, and produces the right output, until I close the FLTK window. when a s...
by jevans4949
Apr 07, 2017 18:49
Forum: Community Discussion
Topic: Download Website Security Issue FIXED
Replies: 13
Views: 1898

Re: ATTENTION TO FB DEV - DOWNLOAD WEBSITE SECURITY ISSUE?

No problems here. Maybe your ISP?
by jevans4949
Apr 07, 2017 1:37
Forum: Libraries
Topic: FLTK-C-1.3.3 for FreeBASIC
Replies: 393
Views: 89288

Re: FLTK C for FreeBASIC Jan 09, 2017

My (infrequent) programming efforts these days mostly revolve around extracting data from one CSV file to another. I figured it would be useful to have a skeleton program to select input and output files with a mickey-mouse routine to copy from one to the other, and do this with FLTK. I have uploade...

Go to advanced search