Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ Forum ➜ Problems ➜ TreeInfo Info

TreeInfo Info

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Trekman1   (1 post)  Bio
Date Thu 27 Feb 2003 10:27 PM (UTC)
Message
Hello all. I want to set comma separators in the tree info output after certain points so I can load the txt file to an excel spreadsheet and have the information split into different cells (in excel I use a comma deliminator) Ideally, I would like the txt. file output to have commas in the following spots:

123.764 Mb, 23 files, C:\pdrives\Gammon
654.345 Mb, 53 files, C:\gdrives\beer

…and so on. This will create 3 cells in excell. How do I modify the source code to include commas at these points…or rather where in the code do I add them. I'm not a big programmer so examples from the actual code will be extremely helpful.
This is a great utility!!
Top

Posted by Nick Gammon   Australia  (23,158 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 04 Mar 2003 01:07 AM (UTC)
Message
I would change these lines:



      if (level == 0)
        {
        mb = (double) nSize.QuadPart / 1024.0 / 1024.0;
        printf ("%9.3f Mb               %s\\%s \n", mb, thisdir, fileinfo.cFileName);
        }


I would add commas or tabs. Tabs might be better because you might have commas in the file names. They will still work with Excel. Tabs are \t so do this:



      if (level == 0)
        {
        mb = (double) nSize.QuadPart / 1024.0 / 1024.0;
        printf ("%9.3f\t%s\\%s \n", mb, thisdir, fileinfo.cFileName);
        }


And also this code:


     if (level == 1)
        {
        mb = (double) *totalsize / 1024.0 / 1024.0;
        printf ("%9.3f Mb %6ld file%s  %s \n", 
                mb, 
                *totalfiles,
                *totalfiles == 1 ? " " : "s",
                thisdir);
        }


To this:


     if (level == 1)
        {
        mb = (double) *totalsize / 1024.0 / 1024.0;
        printf ("%9.3f\t%6ld\t%s \n", 
                mb, 
                *totalfiles,
                thisdir);
        }

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


11,135 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.