fork download
  1. #include <iostream>
  2. #include <fstream>
  3.  
  4.  
  5. int main() {
  6.  
  7. std::vector<std::string> vec;
  8. std::ifstream F("file.txt");
  9.  
  10.     if(!F)
  11. {
  12.         std::cout << "Il file non esiste!";
  13.         return -1;
  14.     }
  15.  
  16. std::string S;
  17.  
  18.     while(getline(F, S))
  19. {
  20. vec.push_back(S);
  21. }
  22.  
  23.     return 0;
  24. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:7:6: error: no member named 'vector' in namespace 'std'
std::vector<std::string> vec;
~~~~~^
prog.cpp:7:24: error: expected '(' for function-style cast or type construction
std::vector<std::string> vec;
            ~~~~~~~~~~~^
prog.cpp:7:26: error: use of undeclared identifier 'vec'
std::vector<std::string> vec;
                         ^
prog.cpp:10:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    if(!F)
^
prog.cpp:10:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    if(!F)
  ^
prog.cpp:12:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        std::cout << "Il file non esiste!";
^
prog.cpp:12:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        std::cout << "Il file non esiste!";
  ^
prog.cpp:12:7: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        std::cout << "Il file non esiste!";
    ^
prog.cpp:12:10: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        std::cout << "Il file non esiste!";
      ^
prog.cpp:13:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        return -1;
^
prog.cpp:13:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        return -1;
  ^
prog.cpp:13:7: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        return -1;
    ^
prog.cpp:13:10: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
        return -1;
      ^
prog.cpp:14:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    }
^
prog.cpp:14:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    }
  ^
prog.cpp:18:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    while(getline(F, S))
^
prog.cpp:18:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    while(getline(F, S))
  ^
prog.cpp:20:11: error: use of undeclared identifier 'vec'
          vec.push_back(S);
          ^
prog.cpp:23:1: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    return 0;
^
prog.cpp:23:4: warning: treating Unicode character as whitespace [-Wunicode-whitespace]
    return 0;
  ^
16 warnings and 4 errors generated.
stdout
Standard output is empty