×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    70

    How can I get the JPEG images of the Image directory on C?

    Can I do like this?

    .h
    RPointerArray<HBufC> filesList;//save all of the images's path include file name


    .cpp

    CDataManager::~CDataManager()
    {
    iFilesList.ResetAndDestroy();
    iFilesList.Close();
    }

    void CDataManager::CreateFileList()
    {
    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    _LIT(PhoneImagePath, "C:\\Data\\Images\\");
    _LIT(KImageName,"*.jpg");

    CDirScan* scan = CDirScan::NewLC(fs);
    scan->SetScanDataL(PhoneImagePath, KEntryAttNormal|KEntryAttHidden,
    ESortByDate, CDirScan::EScanDownTree);

    FOREVER//for(;
    {
    CDir* DirList = 0;
    TRAPD(error, scan->NextL(DirList));
    if (error || !DirList)
    {
    break;
    }
    delete DirList;

    FindFile(fs, scan->FullPath(), KImageName);
    };
    CleanupStack::PopAndDestroy(2); //scan, fs
    }

    void CDataManager::FindFile(RFs& aFs, const TDesC& aDir, const TDesC& aImageWild)
    {
    CDir* dirList;
    TFindFile FindObj(aFs);
    TInt j = FindObj.FindWildByDir(aImageWild, aDir, dirList);
    if( j == KErrNone )
    {
    for(TInt i=0; i < dirList->Count(); i++)
    {
    TFileName fullname(aDir);
    fullname.Append((*dirList)[i].iName);
    HBufC *buf = HBufC::NewL(fullname.Length());
    *buf = fullname;
    filesList.Append(buf);
    }
    }
    }

    Please tell me where the mistakes are?
    Thank you!
    Last edited by chenqi830521; 2009-01-04 at 05:50.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: How can I get the JPEG images of the Image directory on C?

    You could debug your code in the emulator as a first attempt in order to see what happens (put some .jpeg files to epoc32\winscw\c\data\images).
    A side-note: Symbian already provides a dynamic array for storing descriptors: CDesCArray (CDesCArrayFlat/Seg), you may find it more comfortable than an RPointerArray of HBufC-s.

Similar Threads

  1. Error in packaging process :(
    By a-eqla3 in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2008-07-24, 20:33
  2. Is MIDP2.0 over Symbian OS slow?
    By epolitakis in forum Mobile Java Games
    Replies: 7
    Last Post: 2007-03-16, 09:32
  3. Loading jpeg into an Image Object
    By Tobias_80 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2006-10-18, 19:25
  4. When I load image from jpeg it awry
    By ramis55 in forum Symbian
    Replies: 2
    Last Post: 2005-11-29, 12:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •