rushk

Untitled

Oct 1st, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <cs50.h>
  2. #include <stdio.h>
  3.  
  4. // Loads dictionary into memory, returning true if successful else false
  5. bool load(const char *dictionary)
  6. {
  7. char *small_dictionary = "../dictionary";
  8. FILE *dict = fopen(small_dictionary, "r");
  9. if (dict == NULL)
  10. {
  11. fprintf(stderr, "Could not open\n");
  12. return 2;
  13. }
  14.  
  15. printf("This is the dictionary: %s\n", small_dictionary);
  16. return false;
  17. }
  18.  
  19. int main(int argc, char *argv[])
  20. {
  21. if (argc != 2)
  22. {
  23. printf("error");
  24. return 1;
  25. }
  26. char *dictionary = argv[1];
  27. load(dictionary);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment