I'm using Qt for a project. I'll constanly read from a file with read from unistd.h, but how can i do that? I have tried to use an infinite while loop but my application crash when i do that.
PS i'm beginner when it comes to Qt and fileoperation (unistd.h).
int fd;
char c;
fd = open("/home/stud/txtFile", O_RDWR);//open file
if(fd == -1)
cout << "can't open file" << endl;
read(fd, (void*)&c, 1);
if(c == '1')
//do stuff
else
//do stuff