Problem:
using printf("%f", 1.2);
prints
%f
instead of
1.20000
Possible reasons:
no math lib included
Possible solutions:
- add -lmieee or -lmsoft (or other math library -> see vbcc manual) to list of compiler options
- put -lmieee (or whatever math lib you're using) before -lvc in list of compiler libs options
Amiga computing solutions - networking, graphics, file conversion, system setup, development, ... If you have suggestions, corrections, additions please leave a comment - thanks!
*** DISCLAIMER: The information on these pages is not an official instruction or documentation. No responsibility will be taken. Use at your own risk. ***
Showing posts with label development. Show all posts
Showing posts with label development. Show all posts
Tuesday, August 15, 2017
Saturday, August 12, 2017
how do I properly read user input using a AmigaDOS script?
Problem:
- user input handling via "ask" isn't sufficient
- empty user input (empty string, user just hit return) can't be checked
Possible solution:
this is an example AmigaDOS script asking user for an ip address, and using a default value if user just hits return:
; default value:
set DEF_IP 192.168.178.1
; message to user, including default value:
echo "please enter your IP address (default: ${DEF_IP}):"
; unset variable before use, for proper testing afterwards:
unset IP
; read user input into variable.
; if user just hits return, variable doesn't get set.
set >nil: IP ?
; get variable, suppress output:
get >nil: IP
; if there was an error, it means variable hasn't been set.
if WARN
; use default value if there was an error
set IP ${DEF_IP}
endif
; print result (default value, or user input)
echo "using IP address: ${IP}"
- user input handling via "ask" isn't sufficient
- empty user input (empty string, user just hit return) can't be checked
Possible solution:
this is an example AmigaDOS script asking user for an ip address, and using a default value if user just hits return:
; default value:
set DEF_IP 192.168.178.1
; message to user, including default value:
echo "please enter your IP address (default: ${DEF_IP}):"
; unset variable before use, for proper testing afterwards:
unset IP
; read user input into variable.
; if user just hits return, variable doesn't get set.
set >nil: IP ?
; get variable, suppress output:
get >nil: IP
; if there was an error, it means variable hasn't been set.
if WARN
; use default value if there was an error
set IP ${DEF_IP}
endif
; print result (default value, or user input)
echo "using IP address: ${IP}"
rawkey-class description strings containing Amiga/RAmiga/LAmiga not working under AmigaOS2.0?
Problem:
- rawkey-class input filter description strings containing Amiga/RAmiga/LAmiga do not work under AmigaOS2.0
- CxFilter() fails when using such a rawkey-class input filter description string
Possible reasons:
because the Amiga keys are called "Command" in OS versions below 3.
Possible solutions:
Use "Command"/"LCommand"/"RCommand" instead of "Amiga"/"LAmiga"/"RAmiga".
- rawkey-class input filter description strings containing Amiga/RAmiga/LAmiga do not work under AmigaOS2.0
- CxFilter() fails when using such a rawkey-class input filter description string
Possible reasons:
because the Amiga keys are called "Command" in OS versions below 3.
Possible solutions:
Use "Command"/"LCommand"/"RCommand" instead of "Amiga"/"LAmiga"/"RAmiga".
Thursday, July 20, 2017
libgen.h missing / undefined reference to basename() and/or dirname()
Possible reasons:
- libgen.h missing
- functions basename() and/or dirname() not available
Solution:
- drop/remove #include <libgen.h>
- implement functions basename() and/or dirname()
https://linux.die.net/man/3/dirname
or
- get latest ADE (GG/geekgadgets) from AmiNet
http://aminet.net/package/dev/gcc/ADE
- libgen.h missing
- functions basename() and/or dirname() not available
Solution:
- drop/remove #include <libgen.h>
- implement functions basename() and/or dirname()
https://linux.die.net/man/3/dirname
or
- get latest ADE (GG/geekgadgets) from AmiNet
http://aminet.net/package/dev/gcc/ADE
Subscribe to:
Posts (Atom)