×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    76

    Exclamation How can I create a text file in JScript or QML?

    hi all,
    anybody can help me?

    i want to write a text file in my directory ("MyDocs/Documents/"). how can i do this in JavaScript or QML?

    i coded my example project in QML.

    my javascript code:

    function writeFile(sData)
    {

    var fso = new fopen("Scripting.FileSystemObject");
    var fh = fso.CreateTextFile("/home/user/MyDocs/Documents/example.txt", true);
    fh.WriteLine(sData);
    fh.Close();

    }


    but that code now working

    best regards.

  2. #2
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: How can I create a text file in JScript or QML?

    JS has been created for web and it cannot access to the disk for security reasons!
    Do you want to save file on the disk then you need to write a small class in C++ and interface it in QML.

  3. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    76

    Re: How can I create a text file in JScript or QML?

    how can i do?
    can u show me an example?

    thanx for reply.
    best regards.

  4. #4
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: How can I create a text file in JScript or QML?


  5. #5
    Registered User
    Join Date
    Oct 2011
    Posts
    76

    Re: How can I create a text file in JScript or QML?

    thanks a lot @gnuton
    u r awesome.

    i am trying now.
    best regards.

  6. #6
    Registered User
    Join Date
    Oct 2011
    Posts
    76

    Re: How can I create a text file in JScript or QML?

    i tried this way.

    but qt turns that error:
    main.cpp: In function 'int main(int, char**)':
    main.cpp:10: error: 'qmlRegisterType' was not declared in this scope
    main.cpp:10: error: expected primary-expression before ',' token
    main.cpp:10: warning: left-hand operand of comma has no effect
    main.cpp:10: warning: right-hand operand of comma has no effect
    main.cpp:10: warning: right-hand operand of comma has no effect
    main.cpp:10: error: ISO C++ forbids comparison between pointer and integer


    best regards.
    Last edited by prodigy47; 2011-11-30 at 01:22.

  7. #7
    Super Contributor
    Join Date
    Mar 2009
    Posts
    1,024

    Re: How can I create a text file in JScript or QML?

    #include <QDeclarative> is missing in your code.

  8. #8
    Registered User
    Join Date
    Feb 2004
    Location
    france/rennes
    Posts
    76

    Re: How can I create a text file in JScript or QML?

    I have to do that for redak text editor ... opensource

    http://rzr.online.fr/q/redak
    http://rzr.online.fr/q/redak# redak : #FreE #TexT #EditoR : #Qt #QmL ported to #SymbiaN #BellE (#E7) and !n950club #n9 #MeeGo, test
    http://elinux.org/Mobile# Efforts to share a common base for GNU/Linux mobile communities ...
    http://go.cur.lv/files# files to be shared or email me

Similar Threads

  1. How to create text file by J2ME ?
    By Vinit410 in forum Mobile Java General
    Replies: 18
    Last Post: 2012-07-24, 05:36
  2. How to create a text file in j2me...please help !
    By lakshmicse in forum Mobile Java General
    Replies: 1
    Last Post: 2011-01-24, 19:47
  3. how to create text file
    By sulabh120881 in forum Mobile Java General
    Replies: 7
    Last Post: 2007-08-13, 07:05
  4. Create a text file
    By jesusdol in forum Symbian User Interface
    Replies: 1
    Last Post: 2003-10-17, 04:15

Posting Permissions

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