Skip to content

Instantly share code, notes, and snippets.

@gregmankes
Created May 20, 2016 18:38
Show Gist options
  • Save gregmankes/26fd02e2d17c7414d6a3708b2f5b5660 to your computer and use it in GitHub Desktop.
Save gregmankes/26fd02e2d17c7414d6a3708b2f5b5660 to your computer and use it in GitHub Desktop.
Main Function from todo
// Main Function from todo
int main()
{
// Implement
printf("\n\n** TO-DO LIST APPLICATION **\n\n");
DynamicArray* list = dyNew(8);
char command = ' ';
do
{
printf("Press:\n"
"'l' to load to-do list from a file\n"
"'s' to save to-do list to a file\n"
"'a' to add a new task\n"
"'g' to get the first task\n"
"'r' to remove the first task\n"
"'p' to print the list\n"
"'e' to exit the program\n"
);
command = getchar();
// Eat newlines
while (command == '\n')
command = getchar(); // here is what is left out
handleCommand(list, command);
}
while (command != 'e');
dyDelete(list);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment