Guest User

Untitled

a guest
Jun 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <time.h>
  4. #include <string.h>
  5. #include <ctype.h>
  6.  
  7. FILE *fp, *fopen();
  8. char *arrayoffilms[45];
  9. int main()
  10. {
  11. char line[100],junk[100];
  12. fp=fopen("filmtitles.txt","r");
  13. int i=0;
  14. while(!feof(fp)) {
  15. fscanf(fp,"%[^n]s",line);
  16. strcpy(arrayoffilms[i],line);
  17. fscanf(fp,"%[n]s",junk);
  18. i++;
  19. }
  20. fclose(fp);
  21. printf("%snnn",arrayoffilms[i]);
  22. return 0;
  23. }
  24.  
  25. while(fscanf(fp,"%[^n]s",line)) {
  26. strcpy(arrayoffilms[i],line);
  27. fscanf(fp,"%[n]s",junk);
  28. i++;
  29. }
  30.  
  31. fp=fopen("filmtitles.txt","r");
  32. if(fp == NULL) /* error handling */
  33. printf("Could not open file: filenamen");
  34. else{
  35. /* do stuff */
  36. }
  37.  
  38. int length;
  39. while (fscanf(fp, " %99[^n]%n%*[^n]", line, &length) == 1) {
  40. arrayoffilms[i] = malloc(length + 1);
  41. strcpy(arrayoffilms[i], line);
  42. i++;
  43. }
  44.  
  45. while (!feof(ipf)) {
  46.  
  47. while (!feof(ipf)) {
  48. if (!feof(ipf)) {
  49. ch = fgetc(ipf);
Add Comment
Please, Sign In to add comment