Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- long sLen;
- char ch, *filename = (char *)malloc(sizeof(char));
- while(1) //бесконечный цикл чтобы доебывать пользователя пока не введет правильно
- {
- printf("Enter absolute or relative path to the text file with values:\n"); //"введите строчку"
- fflush(stdin);
- sLen=0;
- ch="";
- while((ch = getchar()) != '\n')
- {
- filename[sLen] = ch;
- filename = (char *)realloc(filename,(1 + (sLen++))*sizeof(char));
- }
- filename[sLen] = '\0';
- printf("FILENAME: %s \n", filename);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement