![]() |
|
#1
|
|||
|
|||
array problemHello,
i wan to do c++ program in ubuntu that able to write a summary on the directory example is drwx-x John 4096 d-w--x John 14 lrwx-x John 2300 How to i use array to put per column into array then access them so i can generate a report so it will be like this Summary Total directories = 2 ( the number of d in front determine it) total link files = 1 ( the number of l in front determine it) Name of user = John Total size = 6410 (the total size of last column) for now is i using char to determine the directories and link file CPP / C++ / C Code:
this is what i done to find the directories and link, but i cant use char method to grab name and calculate total size...anyone can tell me any method to generate the report...ty for all help Last edited by LuciWiz : 09-Feb-2009 at 10:00.
Reason: Please insert your C++ between [cpp] & ]/cpp] tags
|
|||
|
#2
|
|||
|
|||
Re: array problemThere are several ways to retain the data:
1) You could keep an array of strings, each entry being a line from the file. Then you could have functions that would read the string to tell you information like: CPP / C++ / C Code:
2) You could define a structure that represents one of these entries and keep an array of these structures. Then, when you read a line from the file, fill the structure and append it to the array. On a side note, your report really does not require you to retain any of the data. Each of those fields is a count that can be incremented when parsing a line, just like you did with "directory" in your example. Also, it looks like one of your questions is about converting a char[] to an integer. See atoi(). I hope this helps. Please post more specific questions if you need more help. |
|
#3
|
|||
|
|||
Re: array problemBe more specific in your questions. Nobody will do the program for you!
Bye! |
Recent GIDBlog
Problems with the Navy (Chiefs) by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Array Problem | lief480 | C++ Forum | 3 | 26-Oct-2008 10:12 |
| where is the problem and can you fix it (php) | oggie | MySQL / PHP Forum | 8 | 14-Apr-2008 16:08 |
| Getting a line error in register | oggie | MySQL / PHP Forum | 5 | 13-Apr-2008 17:16 |
| Loop problem on an array | trp_be | C Programming Language | 1 | 06-Jan-2007 08:49 |
| Need help deleting the last element in the array | headphone69 | C++ Forum | 2 | 15-Mar-2006 20:31 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The