Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.
![]() |
Source code |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
bool MyClass::DoSomethingWithAFile( const QString& path, QString* error ) { QFile file( path ); if( file.open( IO_ReadOnly ) ) { ...doing stuff file.close(); return( TRUE ); } else { *error = file.errorString(); return( FALSE ); } |
![]() |
Source code |
1 2 3 4 5 6 7 |
some function: QString error; if( !DoSomethingWithAFile( "/path/to/file", &error ) { ...stuff ...output error } |
Quoted
Originally posted by boyadg
In my case, something() returns a QString and as I thought that error points to a QString, I thought it was valid to assign what something() returns to *error.
Forum Software: Burning Board®, developed by WoltLab® GmbH
Linux Computer - Linux Forum -
Linux Computer und Notebooks - Lastminute - Wasserbetten & Whirlpools