From ad2f12018b8ce05ed140a0b9a19b2a45149f8f49 Mon Sep 17 00:00:00 2001 From: Tianyu Gao Date: Fri, 12 Apr 2019 02:42:28 +0000 Subject: [PATCH] add device file test (audio_hello.c) --- biscuit/c/audio_hello.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/biscuit/c/audio_hello.c b/biscuit/c/audio_hello.c index 0a32deb..25bc8b5 100644 --- a/biscuit/c/audio_hello.c +++ b/biscuit/c/audio_hello.c @@ -13,8 +13,14 @@ int main(int argc, char **argv) { printf("hello audio world!\n"); - fprintf(stdout, "stdout test ok\n"); - fprintf(stderr, "audio test ok\n'"); + int fd; + fd = open("/dev/stdout", O_WRONLY); + if (fd < 0) { + fprintf(stdout, "fail to open /dev/stdout"); + return 1; + } + + write(fd, "write through device file!\n", 27); return 0; }