Thread: implementing small directory tree in c HELP

  1. #1
    Registered User
    Join Date
    May 2015
    Posts
    1

    implementing small directory tree in c HELP

    ok i have an assigment to implement a binary directory tree

    we have to use enumeration with labels Folder and File

    we have to define type struct FOLDER with elements: name which is a dynamicly string,left and right pointer to the structure and indentifiar which is type enum

    we have to define struct FILE with elements name identifiar and int data

    the part above is clear to me

    but the second part is blurry

    define a function which inserts a childe node to the specific node and if that new node has the identifiar File it should be casted from type FOLDER* to type FILE*, the information of the node should be inserted in theis function
    THIS IS REALLY CONFUSING TO ME

    view source
    print?
    Code:
    
    
    Code:
    01 typedef enum TIP
    02 {
    03 Folder,
    04 File
    05 }TIP;
    06 typedef struct folder
    07 {
    08 char *name;
    09 TIP ident;
    10 struct folder *left,*right;
    11 }FOLDER;
    12 typedef struct datoteka
    13 {char *name;
    14 int data;
    15 TIP ident;



  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 0
    Last Post: 05-02-2013, 10:51 AM
  2. implementing a student database using a binary tree
    By atchy6 in forum C Programming
    Replies: 1
    Last Post: 05-02-2012, 08:44 AM
  3. Small error in C implementing fCfS algo
    By dharmil007 in forum C Programming
    Replies: 13
    Last Post: 03-29-2012, 10:25 AM
  4. Problems implementing a binary tree
    By noops in forum C Programming
    Replies: 3
    Last Post: 07-22-2008, 02:39 AM
  5. Building a tree from a directory structure
    By geekoftheweek in forum C Programming
    Replies: 2
    Last Post: 11-26-2007, 03:15 AM

Tags for this Thread