×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    6

    Unhappy How to open file with fopen()?How to get data with fread()?

    I use AknCommonDialogs::RunSelectDlgLD to select file. Then How to open it with fopen()?How to get data with fread()?

  2. #2
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122

    Re: How to open file with fopen()?How to get data with fread()?

    If you are already writing new Symbian-specific code, I think you are better off with the native Symbian APIs. For example, use RFs, RFile etc. for file access.

    AknCommonDialogs::RunSelectDlgLD() places the file name in a 16-bit descriptor. To use it with fopen(), you will have to convert it to a 8-bit zero-terminated C string. With RFIle you can pass in file names as 16-bit descriptors so you do no need to do any conversions.

    Furthermore, standard C file access examples are all over the internet. A good starting point is the s60opencdoc.chm documentation supplied with Open C.

    Lauri

  3. #3
    Regular Contributor
    Join Date
    Oct 2004
    Posts
    107

    Re: How to open file with fopen()?How to get data with fread()?

    Some basic ways to use it will be like this

    #include <libc\stdio.h >


    char* name = "C:\\Media files\\document\\Logs.txt";
    FILE *file_lp;

    file_lp = fopen (name, "r");
    if (file_lp == NULL)
    {
    /* Can't open the file in read mode */
    // free any memory allocated
    return (-1);
    }

    // for reading character by character
    int ret_l;
    ret_l = fgetc(file_lp);

    // closing the file
    fclose(file_lp);



    // for more info about fread refer this link


    http://www.cplusplus.com/reference/c...dio/fread.html


    With Regards

Similar Threads

  1. Error with makesis.exe and creating the .pkg file
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-10-10, 13:53
  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. Replies: 2
    Last Post: 2006-10-04, 19:41
  4. XHTML : File open Error
    By as_vijay_anand in forum Browsing and Mark-ups
    Replies: 0
    Last Post: 2006-09-19, 06:36
  5. Data file encryption in S60 3rd
    By whitewinds in forum Symbian
    Replies: 6
    Last Post: 2006-08-08, 09:19

Posting Permissions

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