Homework 4.6.1

#include <stdio.h>
#include <stdlib.h>

typedef struct node
{
    char key;
    struct node *left;
    struct node *right;
}
NodeT;

NodeT *root;

NodeT* createbinarytree (FILE *fp)
{
    NodeT *tempvar;
    tempvar= (NodeT*) malloc (sizeof(NodeT));
    char test;
    if (fp != NULL)
    {
        test=fgetc(fp);
    }
    if (test=='#')
    {
        return NULL;
    }
    else
    {
        tempvar->key=test;
        /*if (tempvar->key!=('*'||'/'||'+'||'-'))
        {

        }*/
        tempvar->left=createbinarytree(fp);
        tempvar->right=createbinarytree(fp);
        return tempvar;
    }
    fclose(fp);
}

void postorder(NodeT *root)
{
    if (root != NULL)
    {
        postorder(root->left);
        postorder(root->right);
        printf("\n%c", root->key);
    }

}

int main()
{
    printf("The chars introduced in your file:\n");
    FILE *fp;
    fp=fopen("D:/DSA/aut-eng-2014/Vincze Pistuka C. Roland/Homework 4.6.1/doc.txt","r+");
    if (fp == NULL)
    {
        printf("There is an error with the file");
        exit(1);
    }
    root=createbinarytree(fp);

    postorder(root);
    return 0;
}

//It is not perfect, but I would like to send it.