1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
#include <stdio.h> #include <stdbool.h> #include <string.h> #include "io.h" int main(void) { char buffer[BUFSIZ] = {0}; if (!ReadFile("version.txt", BUFSIZ, buffer)) { return -1; } char *b = strrchr(buffer, '\n'); if (b != NULL) { *b = '\0'; } printf("Hello %s\n", buffer); return 0; }