bolt/deps/llvm-18.1.8/compiler-rt/test/sanitizer_common/TestCases/Posix/fgets.cpp

17 lines
271 B
C++
Raw Normal View History

2025-02-14 19:21:04 +01:00
// RUN: %clangxx -g %s -o %t && %run %t
#include <assert.h>
#include <stdio.h>
int main(int argc, char **argv) {
FILE *fp = fopen(argv[0], "r");
assert(fp);
char buf[2];
char *s = fgets(buf, sizeof(buf), fp);
assert(s);
assert(!fclose(fp));
return 0;
}