Welcome, Guest |
You have to register before you can post on our site.
|
|
|
Be warned, I'm back! |
Posted by: Unseen Machine - 7 hours ago - Forum: General Discussion
- Replies (1)
|
 |
Hey folks,
So I have finally managed to get a modern laptop and can now run the latest version of QB64!
I have resumed updating my libraries, demos and games and will of course need help/pointers and feedback...i'm sure you guys will be as congenial as ever though!
Thanks and happy coding!
Unseen
|
|
|
Converting bytes into KB,MB,GB,TB,PB |
Posted by: euklides - 11 hours ago - Forum: Programs
- Replies (6)
|
 |
I needed a little function for convert bytes into KB,MB,GB,TB,PB.
Here she is..
Code: (Select All) 'Convert Bytes in KB,MB,GB,TB,TB
'put also spaces in long numbers
A$ = "123122555552344566": Print " "; CHIFFRESPACE$(A$)
A$ = "234855666": Print " "; CHIFFRESPACE$(A$)
A$ = "6000234855666": Print " "; CHIFFRESPACE$(A$)
A$ = "512445666": Print " "; CHIFFRESPACE$(A$)
A$ = "512": Print " "; CHIFFRESPACE$(A$)
A$ = "14265444444": Print " "; CHIFFRESPACE$(A$)
A$ = "1355": Print " "; CHIFFRESPACE$(A$)
Sleep
End
Function CHIFFRESPACE$ (D$)
DD$ = D$: OCTEX$ = D$: DD1$ = "": sauto = 0
For yu = Len(DD$) To 1 Step -1
DD1$ = Mid$(DD$, yu, 1) + DD1$: sauto = sauto + 1: If sauto = 3 Then DD1$ = " " + DD1$: sauto = 0
Next yu
XCHIF$ = OCTEX$: YCHIF# = Val(XCHIF$)
NBC = Int((Log(Val(XCHIF$)) / 2.303) + 1.01) 'number of digits... in OCTEX$
If NBC < 4 Then FF$ = XCHIF$: UND$ = "bytes": GoTo aa
If NBC < 7 Then ZCHIF# = Int(YCHIF# / 1024 * 10000) / 10000: FF$ = Str$(ZCHIF#): UND$ = "KB": GoTo aa
If NBC < 10 Then ZCHIF# = Int(YCHIF# / 1024 / 1024 * 10000) / 10000: FF$ = Str$(ZCHIF#): UND$ = "MB": GoTo aa
If NBC < 13 Then ZCHIF# = Int(YCHIF# / 1024 / 1024 / 1024 * 10000) / 10000: FF$ = Str$(ZCHIF#): UND$ = "GB": GoTo aa
If NBC < 16 Then ZCHIF# = Int(YCHIF# / 1024 / 1024 / 1024 / 1024 * 10000) / 10000: FF$ = Str$(ZCHIF#): UND$ = "TB": GoTo aa
ZCHIF# = Int(YCHIF# / 1024 / 1024 / 1024 / 1024 / 1024 * 10000) / 10000: FF$ = Str$(ZCHIF#): UND$ = "PB"
aa: FF$ = _Trim$(FF$): If Left$(FF$, 1) = "." Then FF$ = "0" + FF$
If InStr(FF$, ".") = 0 Then FF$ = FF$ + ".0000"
JFF = InStr(FF$, "."): FF$ = Left$(FF$ + "0000000000000000", JFF + 4)
JFF = InStr(FF$, "."): Mid$(FF$, JFF, 1) = ","
Octey$ = " (" + FF$ + " " + UND$ + ")"
DD1$ = Left$(_Trim$(DD1$) + " bytes" + String$(60, 32), 55): W = Len(Octey$): Mid$(DD1$, Len(DD1$) - W, Len(Octey$)) = Octey$
CHIFFRESPACE$ = DD1$
End Function
|
|
|
32 vs 64 bit math |
Posted by: FCS_coder - 05-29-2025, 10:37 AM - Forum: Help Me!
- Replies (8)
|
 |
Hi all, new to the forum, new to QB64, but have done some coding in QB.
I have a general question on the math capabilities available. I am tied down rright now to a 32-bit Win 11 machine. I would like to do some math operations using 64-bit integers. Will QB 64 be able to give me the full precision of the 64-bits? I realize that I will lose speed on the thunking from 32 to 64 bits, but I can always recompile and run on a 64-bit machine when I get access to one.
I want to start coding again since I have some forced free time so expect some more general under-the-hood type questions.
|
|
|
Inputting output from other languages |
Posted by: Helium5793 - 05-26-2025, 05:17 PM - Forum: Help Me!
- Replies (8)
|
 |
Hi,
I have several programs that call python programs, the python program writes its results to disk and then the basic reads the results and uses them. (some of the python libraries are very useful). In particular I am using pyephem, a library that calculates astronomical date on stars and planets.
Is there a way to do this without the intermediate step of writing the information to disk? Can the output of an external program be ported directly into a basic array or other structure?
John
|
|
|
Got an idea will it work ? |
Posted by: doppler - 05-25-2025, 11:52 AM - Forum: General Discussion
- Replies (7)
|
 |
Before I go off and try this. I will ask it here to see if "Yes you can and it would work". Generally the best idea's stay private and nobody benefits. I hate that approach.
What i do now: I use a program called Total Commander if you have used Norton commander in the past you know what I mean. It's great for finding all the filenames in a directory (sub-directories) or drive. From the total list show I can select via (numpad +) and subset based on a select pattern ie: *.jpg I can clip and drop that list into another program for processing. In short I have a list dropped into a program.
Is it possible: Using a console window in qb64pe to find all those JPG's list them with paths in the window, select them with ctrl-a and drop them into the program. Using it this way, I save lot's of clicks and steps.
I have done some amazing things I never did with qb45 using qb64pe (and extensions). If it's possible I have another sharp tool for the my toy box. If I figured wrong. Got an idea ?
Thanks
PS.
I never thought of this forum or users to be like Reddit. Everyone here is both helpful and smart as fuck.
|
|
|
Pringle-like Shape Animation |
Posted by: SierraKen - 05-24-2025, 12:38 AM - Forum: Programs
- No Replies
|
 |
I asked ChatGPT to make me a Pringle. So tinkering around with it I made this animation.
Code: (Select All)
Screen _NewImage(600, 600, 32)
CENTERX = 300
CENTERY = 300
' Pringle parameters
SIZE = 300
STP = 1
Const ZSCALE = 30 ' Controls how much "curve" there is
num = 20
dir = 20
t = 4
Do
If num > 3000 Then
dir = -20
End If
If num < -3000 Then
dir = 20
End If
num = num + dir * t
For x! = -SIZE To SIZE Step STP
For y! = -SIZE To SIZE Step STP
' Hyperbolic paraboloid formula: z = (x^2 - y^2) / scale
z! = ((x! ^ 2) - (y! ^ 2)) / (SIZE * ZSCALE)
' Project to screen (top-down view with z as shading)
screenX = CENTERX + x!
screenY = CENTERY + y!
' Shade based on height (z)
shade = 128 + z! * num
If shade < 0 Then shade = 0
If shade > 255 Then shade = 255
PSet (screenX, screenY), _RGB(shade, shade, 255 - shade)
Next
Next
Loop Until InKey$ = Chr$(27)
|
|
|
|