Programming problem

Hello.

I wrote a program and qcc in QNX 6.2.1. But when i try to run it,
following message appear and program doesn’t run.

Memory fault (core dumped)

The program is:

#include <hw/inout.h>
int data;
int main(void)
{
data=in8(0x2fa);
return 0;
}

What’s wrong?

Thanks,
Orlov.

Hi Orlov,

You have to request I/O privity to use the in/out calls. Try
adding the following line to your code and make sure you
are running as ‘root’.

ThreadCtl(_NTO_TCTL_IO, 0);

See the docs for ThreadCtl for details:
http://www.qnx.com/developers/docs/momentics621_docs/neutrino/lib_ref/t/thre
adctl.html

Regards,
Barry

“Roman Orlov” <sappheiros@yandex.ru> wrote in message
news:40FB94C2.3060908@yandex.ru

Hello.

I wrote a program and qcc in QNX 6.2.1. But when i try to run it,
following message appear and program doesn’t run.

Memory fault (core dumped)

The program is:

#include <hw/inout.h
int data;
int main(void)
{
data=in8(0x2fa);
return 0;
}

What’s wrong?

Thanks,
Orlov.