Thread: file query

  1. #1
    Registered User
    Join Date
    Feb 2006

    file query

    Hey ,I was trying to design a code to handle file.It consists of character nodes.Line nodes that include character nodes. and a file that includes line node .

    I wrote this code below,but it won't work.Wonder if some-one can help spot the error.

    typedef struct CharacterNode {
    	struct CharacterNode *nextCharacterNode;
    	char data;
    typedef struct LineNode {
    	struct CharacterNode *characterNode;
    	struct LineNode *nextLineNode;
    typedef struct fileADT {
    	struct LineNode *lineNode;
    	int size;
    void initFileADT(FileADT *file) {
        file->lineNode = NULL;
    int main(int argc, char *argv[]) {
    	FileADT *a;
        return EXIT_SUCCESS;
    thanx ppl

  2. #2
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Out of scope
    You have to allocate memory for the pointer. By the time you're initializing the variables, it's just a NULL pointer. If you don't know how, look into malloc().
    Sent from my iPadŽ

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 08:35 AM
  2. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  3. me take a look at this: File Encryptor
    By heljy in forum C Programming
    Replies: 3
    Last Post: 03-23-2002, 09:57 AM
  4. Need a suggestion on a school project..
    By Screwz Luse in forum C Programming
    Replies: 5
    Last Post: 11-27-2001, 01:58 AM
Website Security Test