FFILE.CPP
上传用户:xr_qian
上传日期:2007-01-05
资源大小:443k
文件大小:4k
源码类别:

通讯/手机编程

开发平台:

DOS

  1. // ******************************************************************** //
  2. //                                                                      //
  3. //      FFILE.CPP                                                       //
  4. //      Copyright (c) 1993, Michael Holmes and Bob Flanders             //
  5. //      C++ Communication Utilities                                     //
  6. //                                                                      //
  7. //      This file contains the routines under the FILE main             //
  8. //      menu entry.                                                     //
  9. //                                                                      //
  10. // ******************************************************************** //
  11. /* ******************************************************************** *
  12.  *
  13.  *  f_open() -- open a G3 fax file
  14.  *
  15.  * ******************************************************************** */
  16. int     f_open(int c, int r)                // column and row
  17. {
  18. char   *filename = 0,                       // download filename pointer
  19.         buf[40];                            // string buffer
  20. Window  o_win(c, r,                         // define temporary window
  21.             c + 39, r + 2,                  // ..to hold message
  22.             menu_cn, menu_cr);              // ..using system colors
  23. o_win.Open(double_line);                    // open window with a border
  24. o_win.Display(open_msg);                    // give filename prompt
  25. if (field_edit(&o_win,                      // q. prompt for the filename
  26.             strlen(open_msg) + 1, 1,        // ..on the 1st row, did we
  27.             &filename, 25) == 0)            // ..get a good user response?
  28.     return(0);                              // a. no .. return to caller
  29. if (f_locate(trim(filename)))               // q. file found?
  30.     {
  31.     free(filename);                         // a. no .. release memory
  32.     status_line(status, "");                // ..clear status line
  33.     return(0);                              // ..and return to caller
  34.     }
  35.  else
  36.     {
  37.     sprintf(buf, status_file,               // format file information
  38.             filename, f_pgcnt);             // ..for status line
  39.     if (f_pgcnt > 1)                        // q. more than 1 page fax?
  40.         strcat(buf, "s");                   // a. yes .. pluralize page
  41.     status_line(status, buf);               // update status line
  42.     free(filename);                         // release memory
  43.     return(ESC);                            // finally, return ok
  44.     }
  45. }
  46. /* ******************************************************************** *
  47.  *
  48.  *  f_format() -- format an ASCII file into G3 fax file
  49.  *
  50.  * ******************************************************************** */
  51. int     f_format(int c, int r)              // column and row
  52. {
  53. char   *filename = 0;                       // download filename pointer
  54. Window  f_win(c, r,                         // define temporary window
  55.             c + 39, r + 4,                  // ..to hold message
  56.             menu_cn, menu_cr);              // ..using system colors
  57. f_win.Open(double_line);                    // open window with a border
  58. f_win.Display(open_msg);                    // give filename prompt
  59. if (field_edit(&f_win,                      // q. prompt for the filename
  60.             strlen(open_msg) + 1, 1,        // ..on the 1st row, did we
  61.             &filename, 25) == 0)            // ..get a good user response?
  62.     return(0);                              // a. no .. return to caller
  63. status_line(status, "");                    // ..clear status line
  64. f_build_fax(trim(filename), &f_win);        // try to build a fax file
  65. free(filename);                             // ..release memory
  66. return(ESC);                                // finally, return ok
  67. }