×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    May 2012
    Posts
    1

    Writing to a File

    sir, i want to create and write data in to a file and for this i use this code...but the file is still not creating...
    can u please tell me in which .cpp file i have to write this code and how to call the write2fileL( ) so that my program get executed successfully...
    as i am a beginner so i dont know much...

    static void Write2FileL(const TDesC& aFile,TDesC8& aData)
    {
    RFs fs;
    fs.Connect();
    RFile file;
    file.Replace(fs,aFile,EFileWrite);
    //_LIT8(aData,"hello");
    file.Write(aData);
    file.Close();
    fs.Close();
    }

  2. #2
    Nokia Developer Champion
    Join Date
    Jun 2008
    Location
    Noida,India
    Posts
    4,073

    Re: problem writing in a file

    You can call it from anywhere within the cpp file.Just define it at the top of cpp & call it with mentioned parameters.

  3. #3
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,734

    Re: problem writing in a file

    Make sure that you call this method with a fully specified filename. Like
    Code:
    _LIT(KFileName,"e:\\test.txt");
    Write2File(KFileName, <some data>);

  4. #4
    Registered User
    Join Date
    May 2011
    Posts
    35

    Re: Writing to a File

    It's worth pointing out that functions like fs.Connect() and file.Replace() return error codes as integers which this code is ignoring. If you look at these error codes it will give you much more information about what and where it's going wrong. Values can be found in the online documentation by searching for "e32err.h" (http://library.developer.nokia.com/i...90DC89B7E.html)

Similar Threads

  1. Writing to file
    By dunff2k in forum Symbian
    Replies: 6
    Last Post: 2009-06-04, 11:53
  2. writing to a file
    By gaba88 in forum Symbian
    Replies: 15
    Last Post: 2008-06-26, 06:00
  3. After writing file in binary format the file is reable
    By Rajani_sp in forum Symbian User Interface
    Replies: 6
    Last Post: 2007-11-22, 15:37
  4. File reading & writing help, wav file redaing help
    By shubhamlahoti in forum Mobile Java General
    Replies: 6
    Last Post: 2007-06-27, 09:07
  5. writing to a file
    By amitvaish in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-12-03, 08:16

Posting Permissions

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