Re: General tree assignment in C
- From: kwikius <andy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 1 Feb 2008 13:27:31 -0800 (PST)
On Feb 1, 6:32 pm, Ed Prochak <edproc...@xxxxxxxxx> wrote:
On Feb 1, 2:53 am, kwikius <a...@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
<...>
The above path is a relative path. An absolute path requires a node
that the relative path is applied to.
implementation detail.
You lost me. Which part is an implementation detail ?
<...>
There is no absolute need for polymorphic structures here. A leave is
merely a node with no children.
A directory can be empty
I hope you dont want "change_to_working_directory(file) to succeed?
Functionally you do have to treat them
differently.
They have some things in common too... "Polymorphic" :-)
<...>
Finally some means to represent a path. For simplicity a list of
strings works well
No it does not for this assignment.
List of strings seems relatively trivial in C...
#include "stdio.h"
struct path{
char ** path_list;
int num_elements;
};
int main()
{
char * path_list[] ={"my","projects","hello.cpp"};
struct path my_path;
my_path.path_list = path_list;
my_path.num_elements = 3;
int i;
for (i = 0; i < my_path.num_elements;++i){
printf("%s",my_path.path_list[i]);
if ( i <( my_path.num_elements-1)){
printf("/");
}
};
printf("\n");
<...>
... Whatever...
<...>In C the vast proportion of your time will be spent implementing what
other languages provide as standard rather than solving the actual
problem.
This is a school assignment. the OP must use C so your > tooting the horn of C++ is not helpful.
Toot! Toot ! ... compiler may be a C++ compiler also.
:-)
The Pathname is only an artifact of the user interface, NOT an
inherent properety of file systems.
Users can always migrate to rival system with a nice UI I guess...
(Have you ever worked on a flat
file system?)
The spec describes a hierarchical file-system.
regards
Andy Little
.
- Follow-Ups:
- Re: General tree assignment in C
- From: Ed Prochak
- Re: General tree assignment in C
- References:
- Re: General tree assignment in C
- From: CBFalconer
- Re: General tree assignment in C
- From: kwikius
- Re: General tree assignment in C
- From: Ed Prochak
- Re: General tree assignment in C
- Prev by Date: Re: circumcircle
- Next by Date: Re: General tree assignment in C
- Previous by thread: Re: General tree assignment in C
- Next by thread: Re: General tree assignment in C
- Index(es):
Relevant Pages
|