add error-handling on file-deskriptor
This commit is contained in:
@@ -17,6 +17,9 @@
|
|||||||
void writeFile(char *filename, char *buffer, size_t count)
|
void writeFile(char *filename, char *buffer, size_t count)
|
||||||
{
|
{
|
||||||
int fd = open(filename, O_WRONLY);
|
int fd = open(filename, O_WRONLY);
|
||||||
|
if(fd == -1) {
|
||||||
|
perror("Fehler bei open ");
|
||||||
|
}
|
||||||
write(fd, buffer, count);
|
write(fd, buffer, count);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
@@ -93,7 +96,7 @@ int main()
|
|||||||
registerOutput(PIN_MOTOR1_REVERSE);
|
registerOutput(PIN_MOTOR1_REVERSE);
|
||||||
registerOutput(PIN_MOTOR2_FORWARD);
|
registerOutput(PIN_MOTOR2_FORWARD);
|
||||||
registerOutput(PIN_MOTOR2_REVERSE);
|
registerOutput(PIN_MOTOR2_REVERSE);
|
||||||
|
forward(2);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user