⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ffile.cpp

📁 串行通信编程源码
💻 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

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -