www.pudn.com > commutil.zip > FFILE.CPP


// ******************************************************************** // 
//                                                                      // 
//      FFILE.CPP                                                       // 
//      Copyright (c) 1993, Michael Holmes and Bob Flanders             // 
//      C++ Communication Utilities                                     // 
//                                                                      // 
//      This file contains the routines under the FILE main             // 
//      menu entry.                                                     // 
//                                                                      // 
// ******************************************************************** // 
 
 
/* ******************************************************************** * 
 * 
 *  f_open() -- open a G3 fax file 
 * 
 * ******************************************************************** */ 
 
int     f_open(int c, int r)                // column and row 
{ 
char   *filename = 0,                       // download filename pointer 
        buf[40];                            // string buffer 
Window  o_win(c, r,                         // define temporary window 
            c + 39, r + 2,                  // ..to hold message 
            menu_cn, menu_cr);              // ..using system colors 
 
 
o_win.Open(double_line);                    // open window with a border 
o_win.Display(open_msg);                    // give filename prompt 
 
if (field_edit(&o_win,                      // q. prompt for the filename 
            strlen(open_msg) + 1, 1,        // ..on the 1st row, did we 
            &filename, 25) == 0)            // ..get a good user response? 
    return(0);                              // a. no .. return to caller 
 
if (f_locate(trim(filename)))               // q. file found? 
    { 
    free(filename);                         // a. no .. release memory 
    status_line(status, "");                // ..clear status line 
    return(0);                              // ..and return to caller 
    } 
 else 
    { 
    sprintf(buf, status_file,               // format file information 
            filename, f_pgcnt);             // ..for status line 
 
    if (f_pgcnt > 1)                        // q. more than 1 page fax? 
        strcat(buf, "s");                   // a. yes .. pluralize page 
 
    status_line(status, buf);               // update status line 
    free(filename);                         // release memory 
 
    return(ESC);                            // finally, return ok 
    } 
} 
 
 
 
/* ******************************************************************** * 
 * 
 *  f_format() -- format an ASCII file into G3 fax file 
 * 
 * ******************************************************************** */ 
 
int     f_format(int c, int r)              // column and row 
{ 
char   *filename = 0;                       // download filename pointer 
Window  f_win(c, r,                         // define temporary window 
            c + 39, r + 4,                  // ..to hold message 
            menu_cn, menu_cr);              // ..using system colors 
 
 
f_win.Open(double_line);                    // open window with a border 
f_win.Display(open_msg);                    // give filename prompt 
 
if (field_edit(&f_win,                      // q. prompt for the filename 
            strlen(open_msg) + 1, 1,        // ..on the 1st row, did we 
            &filename, 25) == 0)            // ..get a good user response? 
    return(0);                              // a. no .. return to caller 
 
status_line(status, "");                    // ..clear status line 
f_build_fax(trim(filename), &f_win);        // try to build a fax file 
free(filename);                             // ..release memory 
return(ESC);                                // finally, return ok 
 
}