×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    44

    what format to save mp3 file?

    I want downloal a mp3 file via httpengine, and save it, but when I save it ,it always been saved as wrong format, and I cann't play it, following is my code

    the red part is to convert aResponse from unicode to utf8, when I use following code to download a xml file, it works with right format, but when I use it to download a mp3 file, it can save as right format, can anyone help me?

    void CSongInfoDlg::ResponseReceivedL(const TDesC& aResponse)
    {
    CCnvCharacterSetConverter* converter=CCnvCharacterSetConverter::NewLC();
    if(converter->PrepareToConvertToOrFromL(KCharacterSetIdentifierUtf8,
    iEikonEnv->FsSession())!=CCnvCharacterSetConverter::EAvailable)
    User::Leave(KErrNotSupported);
    TDes8* desc8 ;
    desc8 = (TDes8*)&aResponse;
    if(CCnvCharacterSetConverter::EErrorIllFormedInput == converter->ConvertFromUnicode(*desc8, aResponse))
    User::Leave(KErrArgument); //Leave if error in conversion.
    CleanupStack::PopAndDestroy(); //clean for converter

    SaveMusicToFile(* desc8);
    }


    void CSongInfoDlg::SaveMusicToFile(const TDesC8& aMusic)
    {
    _LIT(KFilenameDestIP,"c:\\mymusic.mp3");
    RFs iFileServer;
    User::LeaveIfError(iFileServer.Connect());
    RFile fp;
    TInt err = fp.Open(iFileServer,KFilenameDestIP,EFileWrite);
    if(err !=KErrNone)
    fp.Create(iFileServer,KFilenameDestIP,EFileWrite);
    TInt pos=0 ;
    fp.Seek(ESeekEnd,pos);
    fp.Write(aMusic);
    fp.Close();
    iFileServer.Close();
    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,166

    Re: what format to save mp3 file?

    CCnvCharacterSetConverter is used to convert unicode text strings to byte based character strings, so you shouldn't use it when dealing with other than text based data.

    Just try saving the responce as it is and it might work better.

    yucca

Similar Threads

  1. Tips on using NDS 1.1
    By mitts in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2006-01-18, 16:07
  2. File save problem
    By zwgoal in forum Symbian
    Replies: 3
    Last Post: 2005-11-11, 10:11
  3. How to turn a amr. file into a mp3
    By bo4590 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-08-06, 13:56
  4. N6600 - Can't move MP3 file to MMC Card if sent by BT
    By sugaray in forum Bluetooth Technology
    Replies: 1
    Last Post: 2004-11-29, 11:59
  5. File Format Unknown (OTA)
    By rapix in forum Mobile Java General
    Replies: 2
    Last Post: 2003-07-31, 19:59

Posting Permissions

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