With this code, you can read a file line by line and therefore read a specific line from a text file:
lineNumber = x; static const char filename[] = "file.txt"; FILE *file = fopen(filename, "r"); int count = 0; if ( file != NULL ) { char line[256]; while (fgets(line, sizeof line, file) != NULL) { if (count == lineNumber) {
invalid_id
source share