I'm trying to get a user's input repeatedly until he/she types in 'done'. So what I have done is:

printf("Enter a name to save and its priority\n");
	scanf("%s %d", q[rear].str, &q[rear].priority);

How can I check for the user's input until he types the word 'done'? So if the user types done, the program will cease to loop. Also, the 'done' should not be written into my struct.

I was thinking:

do{
...
} while (strcmp('WHAT THE USER INPUT', "done") != 0);

How can I store what I've scanf() and compare that to "done"?

I know for int, let's say terminate scanning when user inputs -1 is:

int input;

while(input != -1) {
...
}

but how about char?...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.