I am trying to make my first code to a Verifone Device. This device has Verix OS and Arm Processor. I was following the "OPERATING SYSTEM PROGRAMMING TOOLS REFERENCE MANUAL" and its code works well:
#include <string.h>
#include <svc.h>
char Greeting[] = "Hello!";
void main (void)
{
int display = open(DEV_CONSOLE, O_WRONLY);
write(display, Greeting, strlen(Greeting));
normal_tone();
close(display);
}
however, my code does'nt work well. Why? This and other variations compile, but the entries by keypad does not work.
#include <string.h>
#include <svc.h>
#include <stdio.h>
int main (void)
{
int display = open(DEV_CONSOLE, O_RDWR);
char result[30];
char ent[2]="\0\0";
write(display, "\nEnter a number: ", 17);
read(display, ent, 1);
sprintf(result,"\nPressed key: %s", ent);
write(display, result, strlen(result));
normal_tone();
close(display);
return 0;
}
I have already tried scanf(), fscanf(), getchar(), fgetc(), fgets()... Always happens similars things. Write() and similars sometimes works sometimes not, it depends on the combination with read(), Scanf()...but the read() function and similars never worked on my Verifone device.