Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char** FileRead(char fileName[], int &Size, bool &success)
- {
- FILE* f = fopen(fileName, "r");
- Size = 0;
- char buf[1000];
- char** str = NULL;
- char* estr;
- if(f == NULL)
- {
- printf("Ошибка открытия файла!\n");
- success = false;
- }
- else
- {
- printf("Началось чтение из файла\n");
- while(1)
- {
- estr = fgets (buf, sizeof(buf), f);
- if (estr == NULL)
- {
- if ( feof (f) != 0)
- {
- printf ("\nЧтение файла закончено\n");
- break;
- }
- else
- {
- printf ("\nОшибка чтения из файла\n");
- success = false;
- break;
- }
- }
- str = AddString(str, Size, buf);
- }
- printf ("Закрытие файла: ");
- if ( fclose (f) == EOF)
- {
- printf ("ошибка\n");
- success = false;
- }
- else
- printf ("выполнено\n");
- }
- delete[] estr;
- return str;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement