OSDK C and the scanf() function

Questions, bug reports, features requests, ... about the Oric Software Development Kit. Please indicate clearly in the title the related element (OSDK for generic questions, PictConv, FilePack, XA, Euphoric, etc...) to make it easy to locate messages.

Post Reply
User avatar
Posts: 6
Joined: Tue Jan 06, 2015 7:56 pm
Location: Orleans | France

OSDK C and the scanf() function

Post by astrofra »


I'm quickly testing C programming in OSDK 1.11 and want to use the scanf() function.
Has anyone tried it before ?

I'm testing the following :

Code: Select all

// Using the Scanf() ANSI-C function

#include <stdio.h>

void main()
	char my_str[256];
	printf("What is your name ?\n");
	scanf("%s", my_str);
	printf("Hello %s!\n", my_str);
However, at the moment I get the following answer from the linker :
Building the program HWSIMPLE at adress $800
Compiling MAIN.C
- preprocess
- compile
- convert C to assembly code
- cleanup output
ldx #262
D:\apps\dev\osdk\sample\c\scanf\MAIN.s(3): 08bd:Overflow error
scanbuf reserve 256
D:\apps\dev\osdk\sample\c\scanf\scanf.s(8): 090d:Syntax error
fieldcount db 0
D:\apps\dev\osdk\sample\c\scanf\sscanf.s(53): 0973:Syntax error
numberscan dw 0
D:\apps\dev\osdk\sample\c\scanf\sscanf.s(166): 0a42:Syntax error
signscan db 0
D:\apps\dev\osdk\sample\c\scanf\sscanf.s(167): 0a42:Label defined error
Break after 5 errors
ERROR : Build failed.
Press any key to continue . . .
Dear Oric fellows, any idea of what I'm doing wrong? (attached is my C tiny program)
(3.07 KiB) Downloaded 178 times

User avatar
Site Admin
Posts: 3643
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway

Re: OSDK C and the scanf() function

Post by Dbug »


As it happens, you are probably the first person having tried to use scanf in the OSDK since we switched to XA instead of FRAsm.

Basically we forgot to convert the syntax for the scanf.s and sscanf.s files in the lib folder.
I just fixed that, but until I release a new version of the OSDK you need to use a temporary fix:
- reserve -> .dsb
- db -> .byt
- dw -> .word
I attached the working files in the zip file.

Also, your overflow error is not something that can be fixed, you have added a 256 bytes local variable in your main, that's not going to work very well.
If you move the "char my_str[256];" out of main() that should work just fine.
(1.37 KiB) Downloaded 201 times

Post Reply