Qt is a GUI framework. If you don't want a GUI, there is no need to use Qt. Then just use standard C and/or C++ library functions.
It is not very clear what you want to achieve. Do you want to open a text file and print the content to the console or process it line by line?
That is quite easy. Open the file and read it line by line. Alternatively, read the whole content into an allocated buffer and process the lines by searching for end of line markers (using 0x0A / LF / line feed will work for Linux and Windows).
A simple example for the first option:
#include <stdio.h>
#include <errno.h>
int main(int argc, char *argv[])
{
char lineBuffer[256];
if (argc < 2)
{
printf("No file name specified on command line\r\n");
return 1;
}
FILE *f = fopen(argv[1], "r");
if (NULL == f)
{
perror("Error opening file");
return 1;
}
else
{
while (fgets(lineBuffer, sizeof(lineBuffer), f))
{
printf("%s", lineBuffer);
}
fclose(f);
}
return 0;
}
</errno.h></stdio.h>
I have not tested it but the above example should also work when using QtCreator. Just add 'CONFIG += console' to the project settings.