Results 1 to 4 of 4

Thread: add data to a txt in a url

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Question add data to a txt in a url

    I've made a code that I adds data to test.txt file,
    but now I wanna add data to a txt file on a other computer.
    To explain further:
    I want to add data to my data.txt file which is at url:
    http://localhost/project2/data.txt

    Can someone help me out? this is the code I have for local adding data(works):


    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QFileDialog>
    #include <QTextStream>


    MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
    {
    ui->setupUi(this);
    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    void MainWindow:n_pushButton_3_clicked()
    {
    QFile file("test.txt");
    if (!file.open(QIODevice::Append | QIODevice::Text))
    return;
    QTextStream out(&file);
    out << "Group 1\tExcercise 2\tScore 666\tTime 1:45\n\n";
    }



    Thanks in Advance,
    Jantje78.

  2. #2
    Join Date
    Jan 2006
    Location
    Napoli, Italy
    Posts
    621
    Thanks
    5
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: add data to a txt in a url

    You cannot modify a remote file unless you don't use Network protocols like SMB/NFS that shows remote files as local files.

    One solution may be:
    1. Download a copy of remote file
    2. Modifiy the LOCAL file
    3. Upload the modified file on server


    this solution is good for a FTS file server.

    Other solution may be to use a shared directory on network as a Local Device
    A camel can go 14 days without drink,
    I can't!!!

  3. #3
    Join Date
    Apr 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: add data to a txt in a url

    I was thinking about downloading --> modify --> upload aswell, but I hoped it could be easier...
    Well still thanks for your answer, now I dont have to seek further.

  4. #4
    Join Date
    Apr 2011
    Posts
    7
    Qt products
    Qt4
    Platforms
    Windows

    Question Re: add data to a txt in a url

    Can someone help me out? I have read DownloadImageToDisk in index @ qt.
    But I still can't find out how to just simply download a .txt file from http://81.205.253.205/project2/test.txt

    I know how to modify a tex file but I don't know how to Upload/Download.

    Can someone help me out

Similar Threads

  1. Data structures with qt4
    By NewLegend in forum Qt Programming
    Replies: 5
    Last Post: 25th July 2010, 21:57
  2. Two way data map?
    By chimby in forum Qt Programming
    Replies: 3
    Last Post: 16th January 2009, 22:34
  3. Corrupt JPEG data: premature end of data segment
    By node_ex in forum Qt Programming
    Replies: 1
    Last Post: 19th August 2008, 08:57
  4. How to set data
    By sonuani in forum Qt Programming
    Replies: 1
    Last Post: 21st February 2008, 20:15
  5. How to convert binary data to hexadecimal data
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 8th March 2006, 16:17

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.