c++command-linepalm-ospalmprc-tools

Developing Console Like Apps For Palm OS


I'm learning C++, but i only develop console apps, because graphical C++ development is so much difficult, then i want to know if i can develop console like apps for Palm OS, what i want is this, compile this code for Palm OS for example:

// ClientFille.cpp
// Cria um arquivo sequencial.

#include <iostream>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::ios;

#include <fstream> // Fluxo de arquivos
using std::ofstream; // Gera a saída do fluxo do arquivo

#include <cstdlib>
using std::exit; // Sai do protótipo de funcão

int main()
{
    //  Construtor ofstream abre arquivo
    ofstream outClientFile( "Clients.dat", ios::out );

    // Fecha o programa se não conseguir criar o arquivo
    if ( !outClientFile ) // Operador ! sobrecarregado
    {
       cerr << "File could not be opened" << endl;
       exit( 1 );
    } // Fim do if

    cout << "Enter the account, name, and balance." << endl
       << "Enter end-of-file to end the input.\n? ";

    int account;
    char name[ 30 ];
    double balance;

    // Lê conta, nome e saldo a partir de cin, então coloca no arquivo
    while ( cin >> account >> name >> balance )
    {
       outClientFile << account << ' ' << name << ' ' << balance << endl;
       cout << "? ";
    } // Fim do while

    return 0; // Destruitor ofstream fecha o arquivo
} // Fim de main

Thanks!


Solution

  • The only built-in stdin/stdout interface on Palm OS is the secret "network console". I wrote about this in an old blog entry at http://palmos.combee.net/blog/HiddenIOConsole.html. However, there's no C++ binding for this, so you'd need to make your own stream classes that call into these functions, and the old version of the SDK you need is long forgotten on ACCESS's current website. You can probably find it in an old copy of CodeWarrior for Palm OS.