From cac64436b29348c0a7ef07e22703a567dc830cba Mon Sep 17 00:00:00 2001 From: David Bayer Date: Sun, 12 Jan 2025 11:26:49 +0100 Subject: [PATCH] add perror to example --- cudax/examples/file.cu | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cudax/examples/file.cu b/cudax/examples/file.cu index 67ebef5651e..b419bb6e4e0 100644 --- a/cudax/examples/file.cu +++ b/cudax/examples/file.cu @@ -119,7 +119,12 @@ try printf("waiting for the stream to finish\n"); stream.wait(); - if (numBytesWritten != numBytes) + if (numBytes == -1) + { + perror("Error writing file: "); + exit(EXIT_FAILURE); + } + else if (numBytesWritten != numBytes) { fprintf(stderr, "Error: wrote %ld bytes, expected %ld\n", numBytesWritten, numBytes); exit(EXIT_FAILURE);