Ho provato a fare un programmino per la porta parallela, giā quando compilo mi da alcuni warnings. Quando eseguo che premo F3 per uscire mi da Segmentation Fault... ecco il listato:
#include <stdio.h>
#include <sys/io.h>
#include <ncurses.h>
#define PORTA 0x378
int key;
int main(){
initscr();
noecho();
keypad(stdscr, TRUE);
cbreak();
ioperm(PORTA, 1, 1);
printw("Benvenuto nel programma di prova!\n");
printw("Premi F1 per accendere il LED ed un tasto qualsiasi per spegnerlo.\n");
printw("Premi invece F3 per uscire.\n");
while(key != KEY_F(3)){
key=getch();
while(key == KEY_F(1)) { outb(PORTA, 0x1); }
if(key != KEY_F(1)) {outb(PORTA, 0); } //puō darsi che sia la condizione di questo if a fare casini?
}
ioperm(PORTA, 1, 0); //oppure č ioperm?
refresh();
endwin();
system("reset");
return 0;
}
I warnings che mi da sono:
ciao.c: In function `main':
ciao.c:33: warning: large integer implicitly truncated to unsigned type
ciao.c:36: warning: large integer implicitly truncated to unsigned type
ciao.c:48:2: warning: no newline at end of file
A parte l'ultimo, gli altri cosa sono?