| 70 | } |
| 71 | |
| 72 | int main(int argc, char *argv[]) { |
| 73 | int ch; |
| 74 | bool move = false; |
| 75 | |
| 76 | while ((ch = getopt(argc, argv, "hm")) > 0) { |
| 77 | switch (ch) { |
| 78 | case 'h': |
| 79 | usage(argv[0]); |
| 80 | return 0; |
| 81 | case 'm': |
| 82 | move = true; |
| 83 | break; |
| 84 | default: |
| 85 | break; |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | acl::string s1 = "hello world!"; |
| 90 | std::string s2 = s1; |
| 91 | s2 += ", "; |
| 92 | s2 += s1; |
| 93 | |
| 94 | printf("s1=%s, s2=%s\r\n", s1.c_str(), s2.c_str()); |
| 95 | std::cout << "s1=" << s1 << ", s2=" << s2 << std::endl; |
| 96 | |
| 97 | for (int i = 0 ; i < 2; i++) { |
| 98 | if (s1 == s2) { |
| 99 | printf("strings equal!\r\n"); |
| 100 | } else { |
| 101 | printf("strings not equal!\r\n"); |
| 102 | } |
| 103 | |
| 104 | s2.clear(); |
| 105 | s2 += s1; |
| 106 | } |
| 107 | |
| 108 | test(); |
| 109 | test_main(move); |
| 110 | |
| 111 | #ifdef WIN32 |
| 112 | printf("enter any key to exit\r\n"); |
| 113 | getchar(); |
| 114 | #endif |
| 115 | return (0); |
| 116 | } |