Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //main.cpp
- #include <iostream>
- #include "errors.h"
- using namespace std;
- int main(int argc, char *argv[])
- {
- cout << "\e[H\e[2J\033[1m" << "* * * JENT - Tecnologia a serviço da humanidade [www.jent.com.br] * * *" << endl;
- cout << "\033[1m====================================\nPAFKIT versão 0.12 [Desenvolvimento]\n====================================" << "\033[0m" << endl;
- cout << "\033[1mValidador de arquivos de sistema de PAF para o Ato COTEPE 46/2014\n" << "\033[0m" << endl;
- Errors err;
- ifstream generic;
- // *** Tratamento de erros ***
- // Se o erro foi não ter digitado o nome do arquivo
- if(!argv[1])
- {
- err.errorArgv1();
- } else {
- //Se o erro é não estar podendo abrir o arquivo
- generic.open(argv[1]);
- if(!generic.is_open())
- {
- err.errorOpening(argv[1]);
- }
- }
- return 0;
- }
- //errors.h
- #ifndef ERRORS_H
- #define ERRORS_H
- class Errors
- {
- public:
- Errors();
- int errorArgv1();
- int errorOpening(char *argvError);
- };
- #endif // ERRORS_H
- //errors.cpp
- #include "errors.h"
- #include <iostream>
- using namespace std;
- Errors::Errors()
- {
- }
- int Errors::errorArgv1()
- {
- cout << "ERRO 001: Você não digitou o nome e/ou caminho do arquivo a ser analisado. Tente novamente.\n" << endl;
- return 1;
- }
- int Errors::errorOpening(char *argvError)
- {
- ifstream generic;
- cout << "ERRO 004: Não foi possível ler o arquivo " << argvError << ". Uma destas possibilidades pode ser a causa do problema:\n --> Este se encontra corrompido;\n --> Você não possui permissão de leitura;\n --> Não é um arquivo texto;\n --> Não está no formato exigido no ATO COTEPE.\nVerifique uma destas possibilidades e tente novamente.\n" << endl;
- generic.clear();
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement