Welcome, Guest |
You have to register before you can post on our site.
|
Latest Threads |
The QB64 IDE shell
Forum: Utilities
Last Post: JasonPag
09-16-2024, 05:37 PM
» Replies: 9
» Views: 762
|
Importance regarding Ches...
Forum: Utilities
Last Post: JasonPag
09-01-2024, 06:34 PM
» Replies: 0
» Views: 31
|
Chess and Analysis and En...
Forum: Utilities
Last Post: JasonPag
08-28-2024, 02:37 PM
» Replies: 0
» Views: 32
|
DAY 009:_PutImage
Forum: Keyword of the Day!
Last Post: grymmjack
09-02-2023, 02:57 PM
» Replies: 54
» Views: 2,033
|
Fall Banner Contest?
Forum: Site Suggestions
Last Post: grymmjack
08-31-2023, 11:50 PM
» Replies: 36
» Views: 1,261
|
ColorPicker - Function th...
Forum: Dav
Last Post: Dav
08-31-2023, 11:04 PM
» Replies: 3
» Views: 315
|
Goals(1) = New Tile()
Forum: Works in Progress
Last Post: RhoSigma
08-31-2023, 09:45 PM
» Replies: 3
» Views: 127
|
micro(A)v11
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:14 PM
» Replies: 90
» Views: 3,589
|
Updating The Single Most ...
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 09:13 PM
» Replies: 7
» Views: 254
|
QBJS Image Question
Forum: QBJS, BAM, and Other BASICs
Last Post: bplus
08-31-2023, 05:49 PM
» Replies: 5
» Views: 155
|
|
|
Reverse INSTR ? |
Posted by: TerryRitchie - 05-01-2023, 05:19 AM - Forum: Help Me!
- Replies (4)
|
|
I could have swore I saw a post a while back stating that a reverse INSTR command was either introduced or someone created one but I am having no luck searching for it.
InStrRev (from VB) was quite handy and I find myself needing a QB64 equivalent.
Am I hallucinating? Is my age starting to show? Does anyone else remember this post?
-------- THERE IT IS ----------
UPDATE: I was just about to post this but decided one last time to search the Wiki using the VB name INSTRREV and there it was! The INSTR page in the Wiki makes no mention of INSTRREV. searching for INSTR in the Wiki takes you to the INSTR page with no way of seeing that INSTRREV exists.
|
|
|
Keyboard scancodes. |
Posted by: eoredson - 04-30-2023, 05:23 AM - Forum: Help Me!
- Replies (2)
|
|
Hi,
I have been using the following keyboard scancodes for awhile, but I can't get it to detect Ctrl-Alt-Delete at all:
Code: (Select All) Print "Test keyboard scancodes. Press <Esc> to quit"
On Timer(1) CtrlBreak
Timer On
x = _Exit
Const KEY_RSHIFT& = 100303
Const KEY_LSHIFT& = 100304
Const KEY_RCTRL& = 100305
Const KEY_LCTRL& = 100306
Const KEY_RALT& = 100307
Const KEY_LALT& = 100308
Do
_Limit 100
x& = _KeyHit
If x& > 0 Then
If x& = KEY_RALT& Then
Print "Right-Alt-"
End If
If x& = KEY_LALT& Then
Print "Left-Alt-"
End If
If x& = KEY_RSHIFT& Then
Print "Right-Shift-"
End If
If x& = KEY_LSHIFT& Then
Print "Left-Shift-"
End If
If x& = KEY_RCTRL& Then
Print "Right-Ctrl-"
End If
If x& = KEY_LCTRL& Then
Print "Left-Ctrl-"
End If
End If
If x& < 0 Then
Select Case x&
Case -12
Print "Keypad-5"
Case -108
Print "Ctrl-KeyPad-5"
Case -20
Print "Caps lock"
Case -144
Print "Num lock"
Case -145
Print "Scroll lock"
Case -44
Print "Print-Screen"
'Case Else
' Print x&
End Select
End If
x$ = InKey$
If Len(x$) Then
If x$ = Chr$(27) Then
Exit Do
Else
If Len(x$) = 2 Then
Print Asc(Right$(x$, 1))
Else
Print Asc(x$)
End If
End If
End If
Loop
Timer Off
End
Sub CtrlBreak
x = _Exit
If x Then
Print "Ctrl-Break"
End If
End Sub
|
|
|
BAM: PUTSTRING prototyping |
Posted by: CharlieJV - 04-29-2023, 09:56 PM - Forum: QBJS, BAM, and Other BASICs
- Replies (11)
|
|
I had a wee bug in my first prototype, and since I'm planning on doing all kinds of prototyping as I plan out an include library for the thing, I figured best to aggregate developments in one thread.
The fundamental PUTSTRING feature to graphically position a string on the screen:
The PUTSTRING feature to "roll/unroll" a single character in one or more simultaneous directions (right, left, down, up; each in amounts of between 1 and 7 pixels), graphically positioned on the screen:
|
|
|
C file functions in QB64 ??? |
Posted by: Jack - 04-26-2023, 11:00 AM - Forum: Help Me!
- Replies (11)
|
|
I wonder if it's possible to get the C file functions working in QB64, specifically fopen, fprintf and fclose
I tried the following but it won't compile
Code: (Select All) Type iobuf
ptr As _Offset 'zstring ptr
cnt As Long
bas As _Offset 'zstring ptr
flag As Long
file As Long
charbuf As Long
bufsiz As Long
tmpfname As _Offset 'zstring ptr
End Type
Declare Library
Function fopen%& (file_name As String, mode As String)
Function fclose& (file_ptr As _Offset)
Function fprintf& (file_ptr As _Offset, frmt As String, st As String)
End Declare
Dim As _Offset fp
Dim As String fln, md, frmt, text
Dim As Long status
fln = "fopen-test.txt" + Chr$(0)
md = "w" + Chr$(0)
frmt = "%s\n" + Chr$(0)
text = "hello world" + Chr$(0)
fp = fopen(fln, md)
status = fprintf(fp, frmt, text)
Print "status = fprintf(fp, frmt, text) = "; status
status = fclose(fp)
the compiler log follows
Quote:internal\c\c_compiler\bin\c++.exe -O2 -w -std=gnu++11 -DGLEW_STATIC -DFREEGLUT_STATIC -Iinternal\c\libqb/include -Iinternal\c/parts/core/src/ -Iinternal\c/parts/core/glew/include/ -DDEPENDENCY_NO_SOCKETS -DDEPENDENCY_NO_PRINTER -DDEPENDENCY_NO_ICON -DDEPENDENCY_NO_SCREENIMAGE internal\c/qbx.cpp -c -o internal\c/qbx.o
In file included from internal\c/qbx.cpp:2333:
internal\c/../temp/main.txt: In function 'void QBMAIN(void*)':
internal\c/../temp/main.txt:29:35: error: cannot convert 'intptr_t*' {aka 'long long int*'} to 'FILE*' {aka '_iobuf*'}
29 | *__LONG_STATUS=( int32 )fprintf(__OFFSET_FP,(char*)(__STRING_FRMT)->chr,(char*)(__STRING_TEXT)->chr);
| ^~~~~~~~~~~
| |
| intptr_t* {aka long long int*}
In file included from internal\c\libqb/include/audio.h:21,
from internal\c/qbx.cpp:1:
D:/QB64pe-3.6.0+/internal/c/c_compiler/x86_64-w64-mingw32/include/stdio.h:357:20: note: initializing argument 1 of 'int fprintf(FILE*, const char*, ...)'
357 | int fprintf (FILE *__stream, const char *__format, ...)
| ~~~~~~^~~~~~~~
internal\c/../temp/main.txt:48:34: error: cannot convert 'intptr_t*' {aka 'long long int*'} to 'FILE*' {aka '_iobuf*'}
48 | *__LONG_STATUS=( int32 )fclose(__OFFSET_FP);
| ^~~~~~~~~~~
| |
| intptr_t* {aka long long int*}
D:/QB64pe-3.6.0+/internal/c/c_compiler/x86_64-w64-mingw32/include/stdio.h:615:28: note: initializing argument 1 of 'int fclose(FILE*)'
615 | int __cdecl fclose(FILE *_File);
| ~~~~~~^~~~~
mingw32-make: *** [Makefile:410: internal\c/qbx.o] Error 1
I know that QB64 has file functions but I have a reason to want the C file functions
<edit>
fopen works, it's the other two functions that fail
|
|
|
Can't start QB64PE 3.6.0 more than once. |
Posted by: Fifi - 04-25-2023, 11:50 PM - Forum: General Discussion
- Replies (4)
|
|
Hello all,
Sorry but I've been away for a while and I'm locked with an old problem with QBPE64 3.6.0 that I just installed on a baremetal Acer Notebook.
After the installation, QB64PE starts normally and I can change the size of the IDE.
However, if I quit QB64PE then restart it later, I always get the following error message box:
Internal IDE Error
(module: ide_methods, on line: 18218)
< OK>
However, I can't even click on the OK button and I've only to quit QB64PE and I can't use it anymore.
I know this is an old problem and that it was solved when removing a configuration file but I can't remember what file it is and where it's located.
TIA for your help.
Cheers
Fifi
|
|
|
big factorial |
Posted by: Jack - 04-25-2023, 01:46 AM - Forum: Programs
- Replies (2)
|
|
just for fun
Code: (Select All) $Console:Only
_Dest _Console
Option _Explicit
Dim As Long d, i, n, dm
Dim As Double t
Const big_base = 1000000000~&&
n = 1
While n > 0
Input "n "; n
If n = 0 Then End
' calculate the number of decimal digits of the factorial using the Strling approximation
d = (.2171472409516259# + .4342944819032518 * n) * Log(n) + .3990899341790576# - .4342944819032518# * n
dm = d \ 9 'divide the number of digits by 9 to get the maximum array dimension
ReDim As _Unsigned Long fac(dm)
Dim As String s, sf
t = Timer(.0001)
fac(0) = 1 ' start with 1
For i = 2 To n
a_mul fac(), i
Next
t = Timer(.0001) - t
' convert the array to string
sf = ""
For i = 0 To dm
s = _Trim$(Str$(fac(i)))
If Len(s) < 9 Then
s = String$(9 - Len(s), "0") + s
End If
sf = s + sf
Next
'strip leading 0's
While Left$(sf, 1) = "0"
sf = Mid$(sf, 2)
Wend
Print sf
Print "elapsed time "; t; " seconds"
Wend
Sub a_mul (arr1() As _Unsigned Long, m As _Unsigned _Integer64)
Static As Long nlimbs ' start with 1 number of elements (nlimbs = 0)
Dim As Long carry, i
Dim As _Unsigned _Integer64 tmp
carry = 0
For i = 0 To nlimbs
tmp = m * arr1(i) + carry
carry = tmp \ big_base
arr1(i) = tmp Mod big_base
Next
If carry > 0 Then
nlimbs = nlimbs + 1 ' increment the number of elements
arr1(nlimbs) = carry
End If
End Sub
|
|
|
MemSound has a deficiency :) |
Posted by: Petr - 04-24-2023, 06:37 PM - Forum: Help Me!
- Replies (9)
|
|
Hello,
I just released a new version of SaveSound in my thread. It can also do something that hasn't been here before - save sound in 24 bit Wav format. On that occasion, I discovered that both SndOpen and SndPlay can play the created 24-bit WAV file, but unfortunately, MemSound cannot handle it. This also follows from the help for MemSound, where only 8, 16, 32 bit formats are written about. I recently found out how to create a 24 bit format very easily and I'm assuming you didn't know about this option and that's why it wasn't known.
|
|
|
|