Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Copying CSV file from linux to pendrive causes format change how to fix it ?
Forum Updated to NodeBB v4.3 + New Features

Copying CSV file from linux to pendrive causes format change how to fix it ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 3 Posters 167 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ramkumar Mohan
    wrote on 16 Feb 2023, 13:03 last edited by
    #1

    This is my Code ,

    const QString srcPath = QFileDialog::getOpenFileName(this, "Source file", "/home/pi/git/build-UI-Desktop-Debug/",  "csv files (*.csv)");
    if (srcPath.isNull())
        return false;
    QString name = "Data.csv";
    QString dstPath = QFileDialog::getSaveFileName(this, "Destination file", "/media/pi/"  + name, "All files (*.*)"); 
    if (dstPath.isNull())
        return false;
    
    if (QFile::exists(dstPath))
        if (!QFile::remove(dstPath))
            return false;
    
    return QFile::copy(srcPath, dstPath);
    

    Output :-

    change.JPG

    J 1 Reply Last reply 16 Feb 2023, 14:41
    0
    • R Ramkumar Mohan
      16 Feb 2023, 13:03

      This is my Code ,

      const QString srcPath = QFileDialog::getOpenFileName(this, "Source file", "/home/pi/git/build-UI-Desktop-Debug/",  "csv files (*.csv)");
      if (srcPath.isNull())
          return false;
      QString name = "Data.csv";
      QString dstPath = QFileDialog::getSaveFileName(this, "Destination file", "/media/pi/"  + name, "All files (*.*)"); 
      if (dstPath.isNull())
          return false;
      
      if (QFile::exists(dstPath))
          if (!QFile::remove(dstPath))
              return false;
      
      return QFile::copy(srcPath, dstPath);
      

      Output :-

      change.JPG

      J Offline
      J Offline
      JonB
      wrote on 16 Feb 2023, 14:41 last edited by
      #2

      @Ramkumar-Mohan
      What is a "format change"?

      What did the user enter as source & destination file names/paths? How do we know where/what the file you show in the screenshot is?

      QFile::copy() should just do a copy. Have you checked a byte-by-byte comparison tool to see if the source & destination files are identical?

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mranger90
        wrote on 16 Feb 2023, 14:57 last edited by
        #3

        This looks to me like the copy is still in progress. Maybe its a very large file and you need to give it some time to complete.

        J 1 Reply Last reply 16 Feb 2023, 15:05
        1
        • M mranger90
          16 Feb 2023, 14:57

          This looks to me like the copy is still in progress. Maybe its a very large file and you need to give it some time to complete.

          J Offline
          J Offline
          JonB
          wrote on 16 Feb 2023, 15:05 last edited by
          #4

          @mranger90
          Surely the OP would have allowed for that before posting?! :)

          1 Reply Last reply
          0

          1/4

          16 Feb 2023, 13:03

          • Login

          • Login or register to search.
          1 out of 4
          • First post
            1/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved