Skip to content

Commit

Permalink
add perror to example
Browse files Browse the repository at this point in the history
  • Loading branch information
davebayer committed Jan 12, 2025
1 parent 865ef42 commit cac6443
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cudax/examples/file.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit cac6443

Please sign in to comment.