Advertisement
silver2row

buff

Sep 19th, 2023
1,098
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. // From IBM and their ideas...
  2.  
  3. #include <stdio.h>
  4. #include <signal.h>
  5. #include <errno.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8.  
  9. #ifdef __cplusplus
  10.     extern "C" {
  11. #endif
  12. void iohdlr(int);
  13.  
  14. #ifdef __cplusplus
  15.     }
  16. #endif
  17.  
  18. int main(void) {
  19.    FILE *fp;
  20.    char buffer[80];
  21.    int i = 0;
  22.  
  23.    signal(SIGIOERR, iohdlr);
  24.  
  25.    /* open an MVS binary file */
  26.  
  27.    fp = fopen("testfull.file","wb, recfm=F, lrecl=80");
  28.    if (fp == NULL) exit(99);
  29.  
  30.    memset(buffer, 'A', 80);
  31.  
  32.    /* write to MVS file until it runs out of extents */
  33.  
  34.    while (fwrite(buffer, 1, 80, fp) == 80)
  35.       ++i;
  36.  
  37.    printf("number of successful fwrites of 80 bytes = %d\n", i);
  38.  
  39.    return 0;
  40. }
  41.  
  42. void iohdlr (int signum) {
  43.    __amrc_type save_amrc;
  44.    __amrc2_type save_amrc2;
  45.    char filename[FILENAME_MAX];
  46.    fldata_t info;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement