Search found 7 matches

by fzabkar
Oct 19, 2019 21:39
Forum: Beginners
Topic: Arithmetic overflow handling
Replies: 4
Views: 386

Re: Arithmetic overflow handling

Thanks for all the replies. I have discovered that VB6 code defaults to checking for integer overflows and generates an OverflowException when one occurs. This behaviour can be disabled in the compiler options. I have programmed in QBasic and FreeBASIC, and now I'm trying to get my head around VB6 (...
by fzabkar
Oct 08, 2019 20:52
Forum: Beginners
Topic: Arithmetic overflow handling
Replies: 4
Views: 386

Arithmetic overflow handling

If I add two large 16-bit numbers in FreeBASIC, and if the result is a 17-bit number, then the 17th bit goes into the bit bucket without generating an error message. This is the behaviour that I prefer when I am computing a checksum over a word array. I am currently maintaining source code written i...
by fzabkar
Jul 12, 2019 8:41
Forum: General
Topic: NUL device in DOS and Windows
Replies: 6
Views: 1905

Re: NUL device in DOS and Windows

This code works in DOS and Win32: #include "vbcompat.bi" #include "dir.bi" Dim i As Integer Dim blockdir As String ' Find the next available subdirectory for module components and create it For i = 0 To &HFF blockdir = "Blocks_" & Hex( i, 2 ) If Dir( blockdir, f...
by fzabkar
Jul 12, 2019 4:05
Forum: General
Topic: NUL device in DOS and Windows
Replies: 6
Views: 1905

Re: NUL device in DOS and Windows

In the following example there is only one existing directory (Blocks_00). DOS correctly finds the next available directory (Blocks_01), but Win32 doesn't. #include "vbcompat.bi" Dim i As Integer Dim blockdir As String ' Find the next available subdirectory and create it Print "Testin...
by fzabkar
Jul 10, 2019 23:44
Forum: General
Topic: NUL device in DOS and Windows
Replies: 6
Views: 1905

Re: NUL device in DOS and Windows

Thanks, I'll try it at my next opportunity.

BTW, using the NUL device to test for the existence of a directory was an old DOS Batch trick.

https://www.robvanderwoude.com/battech_ifexistfolder.php
by fzabkar
Jul 10, 2019 23:19
Forum: General
Topic: NUL device in DOS and Windows
Replies: 6
Views: 1905

NUL device in DOS and Windows

I am trying to use the following code to create the next available directory named "Blocks_nn", where nn = 00, 01, 02, etc. When I compile the code for DOS, it works as expected. However, when I compile it for Win32, it finds no spare directories. It would appear that the NUL device is tre...
by fzabkar
Sep 29, 2018 3:00
Forum: Beginners
Topic: Importing C code into a FreeBasic program
Replies: 4
Views: 851

Importing C code into a FreeBasic program

Is there a way to incorporate C code into a FreeBasic program as a callable function in the same way that one can import ASM code? I've read about calling functions in C libraries, but my needs are a little different. Essentially I would like to adapt the Decode function of LZHUF.C. I would like to ...

Go to advanced search