SAT Prep Getting Started

SAT Prep  Getting Started
SAT Prep: Getting Started
Video: AVC (.mp4) 1280×720 15&30fps | Audio: AAC 48KHz 2ch | 129MB
1h 39m | Appropriate for all | May 11, 2015

PR2 – Internet Marketing Article Website…Indexed in Google…Adsense Ready…$49 BIN

Hi all,

Today i am selling PR2 Internet Marketing Articles Site with 1400+ PLR articles posted and 1000+ pages indexed in google already. Its a 6 letter domain with PR2

www.28tool.com

Site has got various internet marketing articles for categories like Facebook Marketing, Search Engine Optimization, Social Media Marketing and many more. Theme has been optimized for High…

PR2 – Internet Marketing Article Website…Indexed in Google…Adsense Ready…$49 BIN

Adding data to doubly linked list that is from a file

As my current function stands I can only read the first set of data from a file. I am sure that it is because of the !feof not functioning the way I want it to but it might also be caused by a bad print list function but I am not to sure. I am pretty much brand new to using dynamic memory so bear with me.

Load from File

void load(FILE *file, Node *head)
{
    char tempArtist[30]={'\0'}, tempAlbum[30]={'\0'}, tempTitle[30]={'\0'}, tempGenre[30]={'\0'},tempSpace='\0';
    SongLength *tempLength=NULL;
    char tempPlay[100]={'\0'}, tempRating[6]={'\0'}, tempMins[3]={'\0'}, tempSecs[3]={'\0'};

    tempLength = (SongLength*)malloc(sizeof(SongLength));

    if(!feof(file))
    {

    while(head->pNext == NULL)
    {
    fscanf(file,"%s",&tempArtist);
    fscanf(file,"%c",&tempSpace);

    strcpy(tempLength->mins,tempMins);
    strcpy(tempLength->secs,tempSecs);
    strcpy(head->data->artist,tempArtist);
    strcpy(head->data->length->mins,tempLength->mins);
    strcpy(head->data->length->secs,tempLength->secs);

    insertNode(head,head->data);
    }
    }
    free(tempLength);

}

Insert to linked list

void insertNode(Node *head, Record *data)
{
    while(head->pNext == NULL)
    {
        head=head->pNext;
    }

    head->pNext=(Node*)malloc(sizeof(Node));
    head->pNext->data = (Record*)malloc(sizeof(Record));
    head->pNext->data->length=(SongLength*)malloc(sizeof(SongLength));

    (head->pNext)->pPrev=head;
    head=head->pNext;
    head->data=data;
    head->pNext=NULL;

}

Print all of the data in the list(hopefully)

void display (Node *head)
{

    while (head->pNext != NULL)
    {
        printf ("Artist: %s\n", head->data->artist);
        printf ("Length(mm:ss) %s:%s\n", head->data->length->mins,head->data->length->secs);

        head=head->pNext;
    }
    putchar ('\n');
}

I have removed all but one of the fscanf()’s and printf()’s to cut down the code.

Structs

typedef struct songlength
{
    char mins[3];
    char secs[3];
}SongLength;

typedef struct record
{
    char artist[30];
    struct songlength *length;      

}Record;

typedef struct node
{
    struct node *pPrev;
    struct record *data;
    struct node *pNext;

}Node;