replace perror with strerror to be able to print the file name
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
#include "play_raw_audio.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <pulse/simple.h>
|
||||
#include <pulse/error.h>
|
||||
#include <pulse/simple.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int play_raw_audio(char file_name[]) {
|
||||
int pa_error = 0;
|
||||
@@ -11,7 +13,7 @@ int play_raw_audio(char file_name[]) {
|
||||
|
||||
int myfd = open(file_name, O_RDONLY);
|
||||
if (myfd == -1) {
|
||||
perror("Failed to open audio file");
|
||||
fprintf(stderr, "Failed to open audio file %s: %s.\n", file_name, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user