Hi,
This C++ does not work:
string line;
getline (INfile,line);
string line;
getline (INfile,line);
QString Line = line;
To copy to clipboard, switch view to plain text mode
error: conversion from ‘std::string’ to non-scalar type ‘QString’ requested
However this C style does work:
char line[50]="";
fgets(line, 50, INfile);
char line[50]="";
fgets(line, 50, INfile);
QString Line = line;
To copy to clipboard, switch view to plain text mode
Why is that? I'd really like to get the C++ style to work. What's the best way to obtain a line from a file in Qt?
Thanks!!
Bookmarks