HelloWorld: writes “Hello World!” to the console

Description

HelloWorld is a very simple piece of code showing how text is written to the console. All other examples in Basics and System use the same technique.

The file CommonFramework.h contains the entry point and all code necessary to support the example itself, including the construction of the console and the cleanup stack. Putting code into a .h file may not be conventional practice, but it is useful to do so here.

Download

Click on the following link to download the example: HelloWorld.zip

Download some additional files required by the example: CommonFramework.zip .

Click browse to view the example code.

Click browse to view the additional file.

Build

The example includes the two project files needed for building: bld.inf and the .mmp file.

The Symbian platform build process describes how to build this application, which results in an executable called:

\epoc32\release\<target>\<urel or udeb>\HELLOWORLD.EXE .

Usage

Run the executable HELLOWORLD.EXE .

Executables for the emulator targets wins and winscw can be run on your PC. Executables for ARM targets must be copied to your target platform before being run.

Classes used

The example shows the use of the _LIT macro which is used throughout all of the examples. The macro generates a:

       
        
       
       const static TLitC<TInt>
      

object and is an efficient and convenient way of generating constant literal text.

As this is a wide (Unicode) build, TLItC<TInt> is a typedef for TLitC16<TInt>.