Closed Thread Icon

Topic awaiting preservation: Queue Remove (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=6756" title="Pages that link to Topic awaiting preservation: Queue Remove (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: Queue Remove <span class="small">(Page 1 of 1)</span>\

 
supreme_commander
Nervous Wreck (II) Inmate

From: QLD
Insane since: Mar 2003

posted posted 08-18-2003 04:47

Hey
i need a had with using the queue remove function. Here is my code
void startDayClients(Queue ** clientQ) {
FILE *clients; //File pointer to client.txt
newClientNode *temp; //Temporary storage for clients

char name[30], address[40],one, final[20]; // variables for inputs


clients = fopen("client.txt", "r"); // remember - client.txt constant
if (clients == NULL) {
printf("Sorry cannot access file\n");
return;
}

//scanning in name and address of clients
while (!feof(clients)) {
fscanf(clients," %[^:]s", name);
fscanf(clients," %c", &one); //scan in : to avoid
fscanf(clients," %[^:]s", address);
fscanf(clients," %[^\n]s", final);

clientConstruct(name, address, &temp);
clientInsert(name, address, &temp);

printf("%s\n", temp->name);
printf("%s", temp->address);


if (!QueueFull((*clientQ))) { //insert into Queue if not full
QueueInsert((*clientQ), (&temp));

}

else {
printf("Sorry Queue is Full\n"); // warning if Queue is full
}

clientDelete(&temp);


}

fclose(clients); //close file

}


void listApplicants(Queue **clientQ) {
//list all applicants on the client queue
//change function - QUEUE output same for below listjobs
char exit[5], name[30], address[40];
Queue * newClientQ;
newClientNode *printNode;

printf("Applicant Name \t\tApplicant Address \n\n");


printNode = (newClientNode*)QueueRemove((*clientQ));
printf("%-30s\t\t%-40s\n", printNode->name, printNode->address);


printf("\n");
printf("Press Enter to Continue.");

//cant get it to scanf (or if do press enter nothing happens)
// if (strlen(exit) == 0) {
// return;
// }

}


the first function takes strings from the file and inserts them into the queue, then the listApplicant file the supose to remove each structure and print the name and address

here is the struct
struct newClientNode {
char *name; // character variable for clients name
char *address; // character variable for clients address
};


If anyone has an idea please give me a hand, I thinking it may have something to either do with inserting into the queue or how it is being removed

Thanks

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 08-18-2003 05:15

supreme_commander: This is already posted here (even though I don't think that is the right place either):
www.ozoneasylum.com/Forum2/HTML/002317.html

and there is no need to double post.

I'll shut this one down and people can seek it out at the above link (or in server-side scripting).

___________________
Emps

FAQs: Emperor

« BackwardsOnwards »

Show Forum Drop Down Menu