2017-04-28 23:15:03 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
int main()
|
|
|
|
{
|
2017-05-04 00:04:23 +02:00
|
|
|
int n;
|
2017-04-28 23:15:03 +02:00
|
|
|
char buf[64];
|
|
|
|
FILE *fptr;
|
|
|
|
|
|
|
|
fptr = fopen("/tmp/qa-fprint.txt", "w");
|
|
|
|
if(fptr == NULL)
|
|
|
|
exit(1);
|
|
|
|
|
|
|
|
fprintf(fptr, "%s", "DONE");
|
|
|
|
fclose(fptr);
|
|
|
|
|
|
|
|
fptr = fopen("/tmp/qa-fprint.txt", "r");
|
|
|
|
if(fptr == NULL)
|
|
|
|
exit(2);
|
2017-05-04 00:04:23 +02:00
|
|
|
n = fread (buf, 1, 64, fptr);
|
|
|
|
buf[n] = '\0';
|
2017-04-28 23:15:03 +02:00
|
|
|
fclose(fptr);
|
|
|
|
|
|
|
|
if(strncmp(buf, "DONE", 4) != 0){
|
|
|
|
printf("'%s'", buf);
|
|
|
|
exit(4);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|