Search found 1053 matches

by jevans4949
Jul 24, 2006 15:44
Forum: Beginners
Topic: FOR doesn't work how i'd expect
Replies: 6
Views: 1576

Also bear in mind that the "TO" expression in a "FOR" statement is calculated at the start of the loop, and not re-calculated. So the following loop terminates at 5, and doesn't go on ad infinitum. n = 5 for i = 1 to n n = n+1 next i I believe this is normal in most BASICs.
by jevans4949
Jul 19, 2006 13:19
Forum: General
Topic: Small speedup for function in FBC source
Replies: 9
Views: 1582

Hmmm, as a more boring programmer I would have probably done the following: Function hToPow2( Byval value As Uinteger ) As Uinteger Static Dim n As Uinteger dim z as uinteger function = 0 z=2 for n = 1 to 31 if value = z then function = n end if z = z shl 1 next n End Function ' Test loop dim x as u...
by jevans4949
Jul 18, 2006 22:59
Forum: Windows
Topic: Remote Process Code Injection
Replies: 20
Views: 8991

Wow! is this the first Virus in FreeBasic?
by jevans4949
Jul 18, 2006 22:43
Forum: Beginners
Topic: I feel dumb, but defstr s doesn't work, code 16
Replies: 4
Views: 1511

Think I read somewhere there was a bug or feature - you have to put a range: DEFSTR S-S
by jevans4949
Jul 15, 2006 1:05
Forum: Beginners
Topic: Compilng a program....
Replies: 16
Views: 4373

...or you can resource it... True if in Windows. If not ... just thinking about something else, and found you can do the following in FreeBasic. This might be useful to you at some point. enum sector north = 1 south = 2 west = 3 east = 4 end enum data north, east, west, south Reading the above will...
by jevans4949
Jul 15, 2006 0:21
Forum: Beginners
Topic: Compilng a program....
Replies: 16
Views: 4373

Even better idea while I was cooking dinner.

Don't bother with merging the program and the .txt file. Just convert the .txt file to DATA statements as mentioned above, writing out as a FB include file, .bi, then at the end of your operational program put an #include statement for it.
by jevans4949
Jul 14, 2006 16:05
Forum: Beginners
Topic: Compilng a program....
Replies: 16
Views: 4373

Well, while Kayak's method is, as I said, ingenious, the "safer" way to do it is to write a little Basic progam which first reads the source of your operational program (which itself uses READ) and copies it forward to a new file, then reads the .TXT file and for each line appends to the o...
by jevans4949
Jul 13, 2006 9:13
Forum: Beginners
Topic: Compilng a program....
Replies: 16
Views: 4373

Ingenious!

But can you get it to write itself?
by jevans4949
Jul 12, 2006 8:10
Forum: Beginners
Topic: problem when input numbers from file
Replies: 2
Views: 1255

In FreeBasic, variables are by default 32-bit integers, not floating-point.

Specify DEFSNG A-Z as first line of your program.
by jevans4949
Jul 09, 2006 13:55
Forum: Beginners
Topic: Compilng a program....
Replies: 16
Views: 4373

my target is ... to create a portable program by which user, only entering a street's name, obtain a text string that explains if that street is at north or south or east or west of the city Data Statements should be OK until the city builds a new street - then you will have to re-release. Here's a...
by jevans4949
Jul 09, 2006 0:55
Forum: Beginners
Topic: Compilng a program....
Replies: 16
Views: 4373

@Eagle: The DATA statement referred to allows you to define what is effectively constant data in your program at the time you are writing the program, and the READ statement allows you to load that data into program variables. It is effectively a method of initialising variables. The program source ...
by jevans4949
Jul 09, 2006 0:35
Forum: Sources, Examples, Tips and Tricks
Topic: "True" Generic Linked Lists
Replies: 20
Views: 12531

Not sure one would always want list members to be deallocated when they went out of scope, or when they were removed from a list. E.g. an application I am looking into is a Single Transferable Vote counting system. Each ballot paper would be held in a linked list attached to a candidate. As a candid...
by jevans4949
Jul 07, 2006 20:26
Forum: Sources, Examples, Tips and Tricks
Topic: "True" Generic Linked Lists
Replies: 20
Views: 12531

I would not expect people to push/pop entire udt's onto a linked list, that, imo, would not be the right solution. I would propose pushing the address of the udt . That's reasonable. I hadn't thought of that. It adds another level of complexity, but it would remove the identification of the UDT's b...
by jevans4949
Jul 07, 2006 12:41
Forum: Sources, Examples, Tips and Tricks
Topic: "True" Generic Linked Lists
Replies: 20
Views: 12531

Cha0s: a masterpiece of programming. My main question is: How useful is it for any practical application? Most times one wants a linked list, it is not just to hold simple numerics, but to hold more complex UDTs, e.g. in a game it might be weapons, armour, magic scrolls ... The developer would have ...
by jevans4949
Jul 04, 2006 22:01
Forum: Beginners
Topic: Is it OK to try the DOS version with a 486 with 8MB RAM?
Replies: 7
Views: 2103

For floating point, it will need to be a 486DX, or a 486SX with the added co-processor.

It will run on Windows 98 no problem.