I've been trying to create a random phrase generator, which reads nouns from one text file and verbs from another text file. That all worked, but now I'm trying to write a method that capitalizes the first letter of the subject, but keep getting the errors
error: C2248: 'QByteArray::operator QNoImplicitBoolCast' : cannot access private member declared in class 'QByteArray'
see declaration of 'QByteArray::operator QNoImplicitBoolCast'
see declaration of 'QByteArray'
I'll post the code for the method (sorry if its not in proper format I'm new)
void MainWindow::returnCap(QString sub){
char *str;
QByteArray ba;
ba = sub.toLatin1();
str = ba.data();
QString firstLetter;
firstLetter = str[0];
QString cappedFirstLetter;
cappedFirstLetter = firstLetter.toUpper();
char flc; //firstLetterChar
flc = cappedFirstLetter.toLatin1();
str[0] = flc;
}
Thanks for any help!