Home
Developer Resources
QNX RTOS v4
QNX RTOS v4 Knowledge Base

QNX RTOS v4 Knowledge Base

Foundry27
Foundry27
QNX RTOS v4 project
Resources

QNX RTOS v4 Knowledge Base

Title sscanf() SIGSEGV in QNX4
Ref. No. QNX.000009661
Category(ies) Development
Issue sscanf() doesn't seem to like the -zu compiler option.  The following code sample will SIGSEGV in 32-bit and print garbage with Null Assignment in 16-bit:

#include <stdio.h>

void main()
{
x09int day, year;
x09char weekday[20], month[20];

x09sscanf ( "Friday August 0014 1987", "%s %s %d %d", weekday, month, &day, &year );

x09printf ( "%s %s %d %dn", weekday, month, day, year );

}

Solution The libraries only support the use of the -zu switch in certain 16-bit memory models, namely
compact, large, and huge. Calling a library function in a -zu environment in the flat, small, or medium memory models may or may not work depending on whether or not the function takes the address of an auto variable (?scanf does).