Changeset 329487c for tests/collections


Ignore:
Timestamp:
Aug 14, 2023, 9:32:06 PM (16 months ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
master
Children:
bcbc7e4
Parents:
6264087
Message:

change examples to use the new wdi manipulator for C-strings to specify string and read size

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/collections/string-istream.cfa

    r6264087 r329487c  
    55
    66void istream_cstr(void) {
    7     char s1[999], s2[999], s3[999], si[999];
    8     sin | wdi(999,s1) | wdi(999,s2) | wdi(999,s3);
     7        enum { size = 999, rsize = size - 1 }; // string size, read size
     8    char s1[size], s2[size], s3[size], si[size];
     9    sin | wdi(size,rsize,s1) | wdi(size,rsize,s2) | wdi(size,rsize,s3);
    910    sout | s1;
    1011    sout | s2;
    1112    sout | s3;
    1213    for(;;) {
    13         sin | wdi(999,si);
     14        sin | wdi(size,rsize,si);
    1415      if (si[0] == '=') break;
    1516        sout | si;
Note: See TracChangeset for help on using the changeset viewer.