Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. error " use of undeclared idetifier IO_ReadOnly ..."
Forum Updated to NodeBB v4.3 + New Features

error " use of undeclared idetifier IO_ReadOnly ..."

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 237 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by
    #1

    Using this example I am obviously missing "OpenMode flags"

    This resource does no help
    https://www.digitalfanatics.org/projects/qt_tutorial/chapter08.html
    defining the flags.

    Is this something QT specific ?

    QStringList lines;
    // QFile file;
    QFile file( "file.txt" );
    // OpenMode flags
    // file.open()
    if ( file.open( IO_ReadOnly ) ) {
    QTextStream stream( &file );
    QString line;
    int i = 1;
    while ( !stream.atEnd() ) {
    line = stream.readLine(); // line of text excluding '\n'
    printf( "%3d: %s\n", i++, line.latin1() );
    lines += line;
    }
    file.close();
    }

    JonBJ 1 Reply Last reply
    0
    • A Anonymous_Banned275

      Using this example I am obviously missing "OpenMode flags"

      This resource does no help
      https://www.digitalfanatics.org/projects/qt_tutorial/chapter08.html
      defining the flags.

      Is this something QT specific ?

      QStringList lines;
      // QFile file;
      QFile file( "file.txt" );
      // OpenMode flags
      // file.open()
      if ( file.open( IO_ReadOnly ) ) {
      QTextStream stream( &file );
      QString line;
      int i = 1;
      while ( !stream.atEnd() ) {
      line = stream.readLine(); // line of text excluding '\n'
      printf( "%3d: %s\n", i++, line.latin1() );
      lines += line;
      }
      file.close();
      }

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @AnneRanch
      If you look at the foot of the example page you quote you will see Copyright (c) 2002-2004 by Johan Thelin (e8johan -at- digitalfanatics.org).

      You must not use such an old example, it was written for Qt 3. Many things have changed since then. The newer constant for IO_ReadOnly is QIODevice::ReadOnly, which should make this compile, but I strongly suggest you simply ditch this example code as there may be other problems (e.g. I don't think your line.latin1() will work) or deprecated code.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved