Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char * file_name;
- const n = 128;
- file_name = (char *) malloc(n*sizeof(char));
- int file_name_length = 0;
- printf("Please, enter the file name:\n");
- scanf("%s", file_name);
- //printf("%s\n", file_name);
- // freopen(file_name,"rb", stdin);
- char c;
- printf("What do you want to do with this fail? To separate it into bits(s) or into pieces of equal length(n)?\n");
- char x;
- //fclose(stdin);
- scanf("%c", &x);
- printf("%c", x);
- if (x == 's')
- {
- int length_s;
- printf("Enter the number of bits:\n");
- scanf("%d", &length_s);
- printf("Enter the name of file where you want to save you file:");
- char * name;
- name = (char*) malloc(n * sizeof(char));
- scanf("%s", name);
- int number_of_files = file_name_length / length_s;
- const char * str = name;
- for (; *str; str++)
- {}
- int length_name = str - name;
- printf("%d", length_name);
- /* freopen(file_name,"rb", stdin);
- while (scanf("%c", &c) != EOF)
- {
- file_name_length++;
- }
- for (int i = 0; i < number_of_files; i++)
- {
- name[length_name - 1] = i + '0';
- freopen(name,"rb", stdin);
- for(int j = 0; j < length_s; j++)
- {
- scanf("%c", &c);
- printf("%c", c);
- }
- }*/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement