[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  Forum
. -> [Folder]  Problems
. . -> [Subject]  TreeInfo Info
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

TreeInfo Info

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


Posted by Trekman1   (1 post)  [Biography] 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!!
[Go to top] top

Posted by Nick Gammon   Australia  (21,380 posts)  [Biography] 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
[Go to top] 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.


3,619 views.

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

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

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

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]