×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    105

    Smile My codes can not create File on real phone while it works on the emulator.

    Hi,guys,I want to create and access a .txt file on my phone with RFile.Replace() and RFile.Open().They works well on the emulator,however,when it comes to the real phone,it can not create file let alone access it.Here are the codes:
    Code:
    //the path for the .txt file
    _LIT(RStoreFile,"C:\\RFileReceiver.txt");
    //The buffer to receive data from the .txt file
    TBuf<16> iReceiver;
    RFs iFS;
    RFile iFile;
    //access data from .txt file and read them to iReceiver
    void FetchReceiverL()
    {
    	iFS.Connect();
    	TInt err=iFile.Open(iFS,RStoreFile,EFileRead);
    	if(err)
    	{
    		GetNumberL();
    		return;
    	}
    	TBuf8<16> iTemp;
    	iFile.Read(iTemp);
    	_LIT8(mark,"#");
    	TInt iLength=iTemp.Find(mark);
    	iTemp=iTemp.Left(iLength);
    	iReceiver.Copy(iTemp);
            iFile.Close();
    	iFS.Close();
    }
    
    //write the data of iReceiver to the .txt file
    void StoreReceiverL()
    {
    	iFS.Connect();
    	iFile.Replace(iFS,RStoreFile,EFileWrite);
    	TBuf8<16> iTemp;
    	iTemp.Copy(iReceiver);
    	iTemp.Append('#');
    	iFile.Write(iTemp);
    	iFile.Close();
    	iFS.Close();
    }
    Here,I need to say that the codes above works well on the emulator,I tried it several times and never failed.But when I run them on my Siemens SX1,I can not find it works:there is no file created...

    Who can tell me why..



    NOTE:

    Sorry to all of you,I have add a return before I call StoreReceiver() inside GetNumberL().So after take out it,the codes works well,so that's what I learned from my fault:One can not be more careful when he is coding....
    Last edited by suiying0792; 2009-05-20 at 11:49.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: My codes can not create File on real phone while it works on the emulator.

    Note that the built-in File Manager does not show c:\, it shows c:\Data instead.

  3. #3
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    105

    Question Re: My codes can not create File on real phone while it works on the emulator.

    Quote Originally Posted by wizard_hu_ View Post
    Note that the built-in File Manager does not show c:\, it shows c:\Data instead.
    Thanks a lot but Sorry ,I have change RStoreFile to "c:\\Data\\RFileReceiver.txt", but it also can not help. Do you think there is some wrong of my codes?
    Last edited by suiying0792; 2009-05-20 at 02:09. Reason: thanks for reply

  4. #4
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    105

    Question Re: My codes can not create File on real phone while it works on the emulator.

    Does anyone here have met this problem? Please help me , I have change my RStoreFile from "C:\\RFileReceiver.txt" to "C:\\Data\\RFileReceiver.txt",and it does not hlep.

  5. #5
    Registered User
    Join Date
    Aug 2008
    Posts
    7

    Re: My codes can not create File on real phone while it works on the emulator.

    Add WriteUserData in the Capability.
    if that not work also add WriteDeviceData that will solve your problem

  6. #6
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    105

    Question Re: My codes can not create File on real phone while it works on the emulator.

    Quote Originally Posted by karimjiwani View Post
    Add WriteUserData in the Capability.
    if that not work also add WriteDeviceData that will solve your problem
    Thank you , but my phone is Siemens SX1 and the SDK is 1.2, and after adding capability to mmp file , when I use command "abld makefile vc6" , it says unrecognised command. and after makesis and run it on my phone ,it still can not create file.

  7. #7
    Super Contributor
    Join Date
    Mar 2004
    Location
    Bangalore,India
    Posts
    2,146

    Re: My codes can not create File on real phone while it works on the emulator.

    I do not see any code to create the file though? Also can you check the error codes to whats going wrong?
    Cheers,
    Mayank

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: My codes can not create File on real phone while it works on the emulator.

    Quote Originally Posted by suiying0792 View Post
    Thank you , but my phone is Siemens SX1 and the SDK is 1.2, and after adding capability to mmp file , when I use command "abld makefile vc6" , it says unrecognised command. and after makesis and run it on my phone ,it still can not create file.
    Well, S60 1.x happened a bit earlier. You should check what folders you see in epoc32\wins\c, the folder might be Nokia and not Data in that version.
    An other thing you could try is checking the physical root of c: (on the device) using a 3rd party file manager (like FExplore).

  9. #9
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    105

    Smile Re: My codes can not create File on real phone while it works on the emulator.

    Quote Originally Posted by wizard_hu_ View Post
    Well, S60 1.x happened a bit earlier. You should check what folders you see in epoc32\wins\c, the folder might be Nokia and not Data in that version.
    An other thing you could try is checking the physical root of c: (on the device) using a 3rd party file manager (like FExplore).
    Sorry to all of you,I have add a return before I call StoreReceiver() inside GetNumberL().So after take out it,the codes works well,so that's what I learned from my fault:One can not be more careful when he is coding....

Similar Threads

  1. Nokia HTTP Example works on Emulator but not on N70 phone
    By msulaiman in forum Symbian Networking & Messaging (Closed)
    Replies: 2
    Last Post: 2007-03-16, 13:07
  2. Replies: 8
    Last Post: 2005-08-09, 14:56
  3. Works in emulator not in phone
    By cervera in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2003-11-07, 15:33

Posting Permissions

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