Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <fstream>
- //разбор параметров
- int main(int argc, char* argv[])
- {
- bool to_screen;
- int i;
- for (i=0;i<argc;i++)
- {
- if (argc > i && argv[i]=="./appname -s screen")
- {
- to_screen = true;
- std::cout << argv[i] << std::endl;
- }
- else if (argc < i || argv[i]=="./appname -s log")
- {
- //пишем в zmq.log
- std::ofstream file;
- file.open("zmq.log");
- file<<argv[i];
- file.close();
- to_screen = false;
- }
- else {
- //если ошибка другого вида , все равно пишем в zmq.log
- std::ofstream file;
- file.open("zmq.log");
- file<<argv[i];
- file.close();
- to_screen = false;
- }
- }
- //нарушена логика , не работает
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement