⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 desc2.cpp

📁 如题 就是 这东西 为什么非要我 说到 20个 字 呢 看看这回 够 不
💻 CPP
字号:
// desc2.cpp
//
// Copyright (c) 1999-2007 Symbian Software Ltd.  All rights reserved.
//
// $Change: 937687 $

// This exercise is designed to build familiarity with RBuf descriptors.

// PROJECT HEADERS
#include "eustd.h"

// Common literal text
_LIT(KTxtPressToContinue,   " \nPress Any Key To Continue\n");

// Common format strings
_LIT(KPtrLengthSize,        "Ptr()=%x; Length()=%d; Size()=%d\n\n");
_LIT(KDescriptor,           "\nThe descriptor is at %x");

// Do the example
LOCAL_C void doExampleL()
    {
    ////////////////////////////
    ////////// RBUF ////////////
    ////////////////////////////

    // Comments through this module will guide you through the exercise.

    _LIT(KHeapExample, "I am stored in the Heap");

    //TODO
    // 1 Store above string in the Heap.
    // Declare a RBuf descriptor. Use RBuf::CreateL() to create
    // a heap based buffer (internally to RBuf) with sufficient
    // space to hold KHeapExample.
    // HINT.  You first need to find a away of converting KHeapExample
    // into a TDesC! Then you can use Length() to find out the number
    // of characters in KHeapExample.
    // 
    // As the RBuf descriptor is a locally declared variable, you might
    // want to save a copy of the handle on the cleanup stack (as further
    // methods below in the code might leave).
    //


    //TODO
    // 2 Print KHeapExample string, pointer value, length and size 
    // using the RBuf descriptor. Compile and run the program.

    //TODO
    // 3 Reallocate more memory in the heap to store 
    // "I am stored in Heap - Groovy, and there is more space" string.
    // Display information about this object ( string, ptr, length and size ).
    // Compile and run the program.

    // construction of a new bigger constant literal string.
    _LIT(KBiggerString, "I am stored in the Heap,\nand there is more space!");

    // expand the data area of the existing RBuf descriptor

    // store the new string in the RBuf descriptor

    // print new information

    // pop the RBuf from the cleanup stack and close it.
    
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -