Consider the following file:
This is a text containing the number 1 2 and 1234
This is a text containing the number 1 2 and 1234
To copy to clipboard, switch view to plain text mode
You can use something like this:
qint32 number = 0;
char *bigNumber = "";
stream >> text; // text contains the word "This"
stream >> text; // text contains the word "is"
stream >> text; // text contains the word "a"
stream >> text; // text contains the word "text"
stream >> text; // text contains the word "containing"
stream >> text; // text contains the word "the"
stream >> text; // text contains the word "number"
stream >> number; // number = 1
stream >> text; // text contains the word "2"
stream >> text; // text contains the word "and"
stream >> bigNumber; // bigNumber = "1234", bigNumber[0] = "1", etc...
When using bigNumber and a text stream, make sure you double check the sizes!!!
QTextStream stream(&inFile);
QString text = QString("");
qint32 number = 0;
char *bigNumber = "";
stream >> text; // text contains the word "This"
stream >> text; // text contains the word "is"
stream >> text; // text contains the word "a"
stream >> text; // text contains the word "text"
stream >> text; // text contains the word "containing"
stream >> text; // text contains the word "the"
stream >> text; // text contains the word "number"
stream >> number; // number = 1
stream >> text; // text contains the word "2"
stream >> text; // text contains the word "and"
stream >> bigNumber; // bigNumber = "1234", bigNumber[0] = "1", etc...
When using bigNumber and a text stream, make sure you double check the sizes!!!
To copy to clipboard, switch view to plain text mode
Bookmarks