GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — linux_utils/pushd.cpp at main · akamhy/linux_utils Expand file tree/ Copy pathpushd.cppMore file actions 35 lines (28 loc) · 675 Bytes / Copy pathpushd.cppFile metadata and controls35 lines (28 loc) · 675 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 #include <iostream> #include <stack> #include <string> #include <unistd.h> int main(int argc, char* argv[]) { if (argc < 2) { std::cerr << "Error: no directory provided" << std::endl; return 1; } if (chdir(argv[1]) != 0) { perror("chdir"); return 1; } char cwd[1024]; if (getcwd(cwd, sizeof(cwd)) == NULL) { perror("getcwd"); return 1; } std::string current_dir(cwd); static std::stack<std::string> dirstack; dirstack.push(current_dir); std::cout << current_dir << std::endl; std::cout << "Directory stack:" << std::endl; for (const auto& dir : dirstack) { std::cout << " " << dir << std::endl; } return 0; } |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |