Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- #include <string.h>
- #include <ctype.h>
- FILE *fp, *fopen();
- char *arrayoffilms[45];
- int main()
- {
- char line[100],junk[100];
- fp=fopen("filmtitles.txt","r");
- int i=0;
- while(!feof(fp)) {
- fscanf(fp,"%[^n]s",line);
- strcpy(arrayoffilms[i],line);
- fscanf(fp,"%[n]s",junk);
- i++;
- }
- fclose(fp);
- printf("%snnn",arrayoffilms[i]);
- return 0;
- }
- while(fscanf(fp,"%[^n]s",line)) {
- strcpy(arrayoffilms[i],line);
- fscanf(fp,"%[n]s",junk);
- i++;
- }
- fp=fopen("filmtitles.txt","r");
- if(fp == NULL) /* error handling */
- printf("Could not open file: filenamen");
- else{
- /* do stuff */
- }
- int length;
- while (fscanf(fp, " %99[^n]%n%*[^n]", line, &length) == 1) {
- arrayoffilms[i] = malloc(length + 1);
- strcpy(arrayoffilms[i], line);
- i++;
- }
- while (!feof(ipf)) {
- while (!feof(ipf)) {
- if (!feof(ipf)) {
- ch = fgetc(ipf);
Add Comment
Please, Sign In to add comment