- Timestamp:
- Jan 27, 2024, 11:29:57 PM (11 months ago)
- Branches:
- master
- Children:
- 63e129c
- Parents:
- 765ee42
- Location:
- tests/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/io/.in/manipulatorsInput.txt
r765ee42 rbaa1d5d 20 20 X ZC44%Y 21 21 X ZC55%Y 22 'x' 23 "x" 24 {x} 25 XxY 26 XyY 22 27 abc 23 28 cccccb … … 37 42 X ZC44%Y 38 43 X ZC55%Y 44 'x' 45 "x" 46 {x} 47 XxY 48 XyY 39 49 ab 50 xxxyyy 40 51 0xff 017 15-15 41 52 0xff 017 15-15 -
tests/io/manipulatorsInput.cfa
r765ee42 rbaa1d5d 7 7 // Created On : Sat Jun 8 17:58:54 2019 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Wed Jan 24 18:36:32 202410 // Update Count : 1 049 // Last Modified On : Sat Jan 27 18:47:42 2024 10 // Update Count : 122 11 11 // 12 12 … … 55 55 } 56 56 { 57 char s[] = "yyyyyyyyyyyyyyyyyyyy"; 57 char s[] = "yyyyyyyyyyyyyyyyyyyy"; // Input characters consumed: 58 58 const char sk_fmt[] = "%*[abc]"; 59 scanf( "abc " ); scanf( sk_fmt ); for ( 5 ) scanf( "%*c" ); printf( "1 %s\n", s ); 60 scanf( "%s", s ); printf( "2 %s\n", s ); 61 scanf( "%*s" ); printf( "3 %s\n", s ); 62 scanf( "%8s", s ); printf( "4 %s\n", s ); 63 scanf( "%*8s" ); printf( "5 %s\n", s ); 64 65 scanf( "%[abc]", s ); printf( "6 %s\n", s ); 66 scanf( "%[^abc]", s ); printf( "7 %s\n", s ); 67 scanf( "%*[abc]" ); printf( "8 %s\n", s ); 68 scanf( "%*[^abc]" ); printf( "9 %s\n", s ); 69 scanf( "%8[abc]", s ); printf( "10 %s\n", s ); 70 scanf( "%8[^abc]", s ); printf( "11 %s\n", s ); 71 scanf( "%*8[abc]" ); printf( "12 %s\n", s ); 72 scanf( "%*8[^abc]" ); printf( "13 %s\n", s ); 73 scanf( "\n" ); // must start next line 59 scanf( "abc " ); scanf( sk_fmt ); for ( 5 ) scanf( "%*c" ); printf( "1 %s\n", s ); // |abc |\ncccccb| \nxx\n| 60 scanf( "%s", s ); printf( "2 %s\n", s ); // |abcxxx| 61 scanf( "%*s" ); printf( "3 %s\n", s ); // |\nabcyyy| 62 scanf( "%8s", s ); printf( "4 %s\n", s ); // |\naaaaaaaa| 63 scanf( "%*8s" ); printf( "5 %s\n", s ); // |xxxxxxxx| 64 65 scanf( "%[abc]", s ); printf( "6 %s\n", s ); // |aabbccbb| 66 scanf( "%[^abc]", s ); printf( "7 %s\n", s ); // |dddwww| 67 scanf( "%*[abc]" ); printf( "8 %s\n", s ); // |bbbbbbbb| 68 scanf( "%*[^abc]" ); printf( "9 %s\n", s ); // |wwwwwwww| 69 scanf( "%8[abc]", s ); printf( "10 %s\n", s ); // |aaaaaaaa| 70 scanf( "%8[^abc]", s ); printf( "11 %s\n", s ); // |wwwwwwww| 71 scanf( "%*8[abc]" ); printf( "12 %s\n", s ); // |aaaaaaaa| 72 scanf( "%*8[^abc]" ); printf( "13 %s\n", s ); // |wwwwwwww| 73 scanf( "\n" ); // must start next line // |\n| 74 74 75 75 int rc; 76 76 s[0] = 'q'; s[1] = '\0'; rc = 99; 77 rc = scanf( "%[abc]", s ); printf( "14 rc=%d, %s\n", rc, s ); 77 rc = scanf( "%[abc]", s ); printf( "14 rc=%d, %s\n", rc, s ); // || 78 78 s[0] = 'q'; s[1] = '\0'; rc = 99; 79 rc = scanf( "%[^u]", s ); printf( "15 rc=%d, %s\n", rc, s ); // || 80 scanf( "%*[u]\n" ); // |uuuuu\n| 81 scanf( "%[^\n]\n", s ); printf( "16 %s\n", s ); // |get this line\n| 82 scanf( "%[^%%]%%\n", s ); printf( "17 %s\n", s ); // |@# this line 1)-{}%\n| 83 scanf( "%*[^%%]%%\n", s ); printf( "18 %s\n", s ); // |@# this line 1)-{}%\n| 84 85 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // || 86 scanf( "\"%[^\"]\"", s ); printf( "19 %s\n", s ); // |"abc"| 87 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 88 scanf( "'%[^']'", s ); printf( "20 %s\n", s ); // |'abc '| 89 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 90 scanf( "{%[^}]}", s ); printf( "21 %s\n", s ); // |{ d d\n\nd }| 91 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 92 scanf( "X%[^Y]Y", s ); printf( "22 %s\n", s ); // |X ZC44%Y| 93 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 94 scanf( "X%*[^Y]Y", s ); printf( "23 %s\n", s ); // |X ZC44%Y| 95 scanf( "\n" ); // must start next line // |\n| 79 rc = scanf( "%[^u]", s ); printf( "15 rc=%d, %s\n", rc, s ); // || 80 scanf( "%*[u]\n" ); // |uuuuu\n| 81 scanf( "%[^\n]\n", s ); printf( "16 %s\n", s ); // |get this line\n| 82 scanf( "%[^%%]%%\n", s ); printf( "17 %s\n", s ); // |@# this line 1)-{}%\n| 83 scanf( "%*[^%%]%%\n", s ); printf( "18 %s\n", s ); // |@# this line 1)-{}%\n| 84 85 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // || 86 scanf( "\"%[^\"]\"", s ); printf( "19 %s\n", s ); // |"abc"| 87 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 88 scanf( "'%[^']'", s ); printf( "20 %s\n", s ); // |'abc '| 89 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 90 scanf( "{%[^}]}", s ); printf( "21 %s\n", s ); // |{ d d\n\nd }| 91 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 92 scanf( "X%[^Y]Y", s ); printf( "22 %s\n", s ); // |X ZC44%Y| 93 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 94 scanf( "X%*[^Y]Y", s ); printf( "23 %s\n", s ); // |X ZC44%Y| 95 scanf( "\n" ); // must start next line // |\n| 96 97 char ch; 98 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 99 scanf( "'%c'", &ch ); printf( "24 %c\n", ch ); // |x| 100 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 101 scanf( "\"%c\"", &ch ); printf( "25 %c\n", ch ); // |x| 102 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 103 scanf( "{%c}", &ch ); printf( "26 %c\n", ch ); // |x| 104 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 105 scanf( "X%cY", &ch ); printf( "27 %c\n", ch ); // |x| 106 scanf( "%*[ \f\n\r\t\v]" ); // ignore whitespace // |\n| 107 scanf( "X%*cY", &ch ); printf( "28 %c\n", ch ); // |x| 108 scanf( "\n" ); // must start next line // |\n| 96 109 } 97 110 { … … 128 141 sin | quoted( wdi( sizeof(s), s ), 'X', 'Y' ); sout | "22" | s; 129 142 sin | ignore( quoted( wdi( sizeof(s), s ), 'X', 'Y' ) ); sout | "23" | s; 130 } 131 // Keep harmonized with collections/string-istream-manip 143 144 char ch; 145 sin | quoted( ch ); sout | "24 " | ch; 146 sin | quoted( ch, '\"' ); sout | "25 " | ch; 147 sin | quoted( ch, '{', '}' ); sout | "26 " | ch; 148 sin | quoted( ch, 'X', 'Y' ); sout | "27 " | ch; 149 sin | ignore( quoted( ch, 'X', 'Y' ) ); sout | "28 " | ch; 150 sin | "\n"; 151 } 152 // Keep harmonized with collections/string-istream-manip 132 153 { 133 154 char c; 134 155 sin | c; sout | c; 135 156 sin | ignore( c ); sout | c; 157 158 char ca[3] = { 'a', 'b', 'c' }; 159 sin | wdi( 4, (char &)*&ca[0] ); sout | ca[0] | ca[1] | ca[2]; 160 sin | ignore( wdi( 4, (char &)*&ca[0] ) ); sout | ca[0] | ca[1] | ca[2]; 136 161 137 162 signed char sc;
Note: See TracChangeset
for help on using the changeset viewer.