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 179 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.
  • Ramkumar MohanR Offline
    Ramkumar MohanR Offline
    Ramkumar Mohan
    wrote on 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

    JonBJ 1 Reply Last reply
    0
    • Ramkumar MohanR Ramkumar Mohan

      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

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on 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
      • mranger90M Offline
        mranger90M Offline
        mranger90
        wrote on 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.

        JonBJ 1 Reply Last reply
        1
        • mranger90M mranger90

          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.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

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

          1 Reply Last reply
          0

          • Login

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