Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    Regular Contributor alikhairat's Avatar
    Join Date
    May 2007
    Posts
    73
    I installed the program on the mobile but it comes to a part of a code that i read a file using ReadInt16 but it closes the application without any exeptions just exits.

    any idea.
    Ali Khairat

  2. #2
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,680

  3. #3
    Regular Contributor alikhairat's Avatar
    Join Date
    May 2007
    Posts
    73
    OK I used it but it gave me exeption
    Application closed KERN-EXEC 3

    I know that it doesn't read an audio file maybe there is somethingwron when dealing with the audio file?

    I copy it in the package file
    Code:
    "..\data\SpeechFile.aud"        -"!:\private\A35E2008\SpeechFile.aud"
    So is this write or??

    Can I debug my code on the mobile device?? How?
    Ali Khairat

  4. #4
    Registered User S.S.Sudhakar's Avatar
    Join Date
    Aug 2004
    Location
    Hyderabad,India
    Posts
    808
    Hi,

    Have u checked whether the file is existing at that location before opening the file ( use BaflUtils FileExists())

    KERN-EXEC 3 is for access violation.

    Please paste your code where u r trying to open and read the file so that some one can help you .

    Regards,
    sudhakar
    Regards,
    Sudhakar

  5. #5
    Regular Contributor alikhairat's Avatar
    Join Date
    May 2007
    Posts
    73
    Ok you were right File doesn't exist.
    Here is the code if it could help.

    Code:
    ConstructL()
    	{	
    
    	// Get a handle to the RFs session to be used (owned by CEikonEnv, NOT to be closed
    	// when this application exits!)		
    	iFs = CEikonEnv::Static()->FsSession();
        	User::LeaveIfError( iFs.CreatePrivatePath( EDriveC ) );
    	User::LeaveIfError( iFs.SetSessionToPrivate( EDriveC ) );
    }
    in the class constructor i initialize the file name.

    Code:
    RFileReadStream audiofile;     //read data from this file
    // open file to read from
    TFileName fileName;
    fileNamei.Copy(iFilePath);
    fileNamei.Append(iFileName);
    TInt err = audiofile.Open(iFs, fileName, EFileRead&EFileStream);
    I am using the code from AudioStream example.
    Ali Khairat

  6. #6
    Regular Contributor ptrmn's Avatar
    Join Date
    May 2005
    Location
    Sweden
    Posts
    272
    Yes, you can debug on target. You don't mention which phone you're working with, but debug prints are always an option.
    Mobile Sputnik: http://ptrmobile.blogspot.com/

  7. #7
    Registered User S.S.Sudhakar's Avatar
    Join Date
    Aug 2004
    Location
    Hyderabad,India
    Posts
    808
    Hi,

    File not Existing! I( believe u checked with BaflUtils FileExists()) Then Opening non-existing file is nothing but access violation.

    Regards,
    Sudhakar
    Regards,
    Sudhakar

  8. #8
    Regular Contributor cdavies's Avatar
    Join Date
    May 2007
    Posts
    463
    KERN-EXEC 3s on hardware but not on the emulator are in general indicative that you've overflowed the stack. If you're using large stack based buffers, then you might want to make them heap based.
    Get Resolvr - The Zeroconf framework for Symbian OS free today. Make your IP networking applications fun and easy to use. http://www.novelinteractions.com/resolvr/
    Proud to be the only autorickshaw owner in Cambridge - http://blog.novelinteractions.com/images/tuktuk.jpg

  9. #9
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,680
    Code:
    iFs = CEikonEnv::Static()->FsSession();
    seems a bit suspicious to me (I would not rely on operator= of R-classes).
    You can try having a reference, and initialize it in the constructor:
    Code:
    // .h
    RFs &iFs;
    
    // .cpp
    CYourClass::CYourClass()
    :iFs(CEikonEnv::Static()->FsSession())
    {
    }
    or use local reference variables:
    Code:
    RFs &fs = CEikonEnv::Static()->FsSession();
    ...
    User::LeaveIfError( fs.CreatePrivatePath( EDriveC ) );
    you can also open files with this 'local' RFs, since it is not local, it is just an abbreviation for the RFs of CONE.
    So the key is using references in both cases.

    And a small troublemaker:
    Code:
    TInt err = audiofile.Open(iFs, fileName, EFileRead&EFileStream);
    Should be | instead. In fact both constants are 0, so and-ing them makes no problem, but the general approach is to use or.

  10. #10
    Regular Contributor alikhairat's Avatar
    Join Date
    May 2007
    Posts
    73
    OK first for debuging i am using nokia E60

    second I changed the code it is now.
    Code:
    TInt err = audiofile.Open(iFs, fileName, EFileRead&EFileStream);
    Code:
    // .cpp
    CYourClass::CYourClass()
    :iFs(CEikonEnv::Static()->FsSession())
    I don't understand what do you mean by Local
    Ali Khairat

  11. #11
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    27,680
    I put it in quotes, since it is not really local.
    I meant that something like
    Code:
    // .h
    RFile iFile;
    
    // .cpp
    void CYourClass::OpenOrCreateFileL()
    {
        RFs &fs = CEikonEnv::Static()->FsSession();
        if ( iFile.Open(fs,KFileName,EFileWrite) != KErrNone )
            User::LeaveIfError ( iFile.Replace(fs,KFileName,0) );
    }
    
    void CYourClass::WriteL(const TDesC& aDesC)
    {
        HBufC8 *buf8 = HBufC8::NewLC(aDesC.Length());
        buf8->Des().Copy(aDesC);
        User::LeaveIfError ( iFile.Write(*buf8) );
        CleanupStack::PopAndDestroy();
    }
    is valid, since fs in OpenOrCreateFileL is not a local variable, thus the supplied File Server session remains valid all the time.

    I guess you have already known that, so it does not really matter.

  12. #12
    Regular Contributor alikhairat's Avatar
    Join Date
    May 2007
    Posts
    73
    so if i initials the rfs session in the constructor i should also initials the files in it or make a function and call it from the constructor because i have a lot of files and i use the same iFs to open all of them.

    Another thing how does it work on the emulater and not on the mobile?
    Last edited by alikhairat; 2007-07-31 at 11:47.
    Ali Khairat

  13. #13
    Regular Contributor alikhairat's Avatar
    Join Date
    May 2007
    Posts
    73
    Also I was wondering how to debug it on the device.
    It is Nokia E60 and I am working on carbide express v1.1 S60 3rd Edition sdk
    Ali Khairat

  14. #14
    Regular Contributor alikhairat's Avatar
    Join Date
    May 2007
    Posts
    73
    Ok after some debuging i found out that the file was not even saved.

    In example audiostream i call method record then saveaudiofile is it the problem.
    Ali Khairat

  15. #15
    Registered User S.S.Sudhakar's Avatar
    Join Date
    Aug 2004
    Location
    Hyderabad,India
    Posts
    808
    Hi alikhairat,

    If file is not saved means file is not available so reading non existing file will throw exceptions.

    First work on the saving of recorded file which should automatically solve your issue.

    Regards,
    Sudhakar
    Regards,
    Sudhakar

Page 1 of 2 12 LastLast

Similar Threads

  1. help me on file transfer - pc to phone over bluetooth.
    By kiran10182 in forum Bluetooth Technology
    Replies: 2
    Last Post: 2009-09-05, 10:07
  2. Help needed with a 3gp file...
    By joedoe_1981 in forum Streaming and Video
    Replies: 0
    Last Post: 2007-07-18, 18:58
  3. Contacts fields order??
    By timatima in forum Symbian C++
    Replies: 1
    Last Post: 2007-06-08, 13:51
  4. Read File from Phone Memory
    By decisor in forum Mobile Java General
    Replies: 4
    Last Post: 2006-06-30, 16:02
  5. socket read hangs until socket is closed
    By camroe in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-07-21, 09:44

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved