- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
#include <iostream>
#include <cstdlib>
#include "filesdescrtable.h"
int ___cntr = 0;
#define _(X) if((X) == EXIT_SUCCESS) {___cntr++;} else {std::cerr << "error on operator: " << ___cntr << std::endl; return (EXIT_FAILURE);}
int main (int argc, char *argv[]) {
FilesDescrTable a;
int d1,d2,d3;
_(a.setAutoReport(true));
_(a.openFile(argv[1], O_RDWR | O_CREAT, 0600, d1));
_(a.openFile(argv[2], O_RDWR | O_CREAT, 0600, d2));
_(a.openFile(argv[3], O_RDWR | O_CREAT, 0600, d3));
_(a.clearFile(argv[3]));
_(a.cpy(d3,d2));
_(a.closeFile(d1));
_(a.closeFile(d2));
_(a.closeFile(d3));
return(EXIT_SUCCESS);
}
хитрый макрос для отлова ошибок. такой хитрый
Я верю только в человеческую глупость. А она не персонифицирована.