MarshallSoft
Converted from "WIL4C.TXT"

Winsock Interface Library

for C/C++

Programmer's Manual


(WIL4C)


Version 3.1

April 4, 2000



This software is provided as-is.
There are no warranties, expressed or implied.



Copyright (C) 2000
All rights reserved



MarshallSoft Computing, Inc.
Post Office Box 4543
Huntsville AL 35815



Voice : 256-881-4630

FAX : 256-880-0925

email : info@marshallsoft.com

web : www.marshallsoft.com



MarshallSoft is a member of the Association of Shareware Professionals

MARSHALLSOFT is a registered ® trademark of MarshallSoft Computing.



TABLE OF CONTENTS

1 Introduction
1.1 Documentation Set
1.2 Example Program
1.3 Installation
1.4 Uninstalling
1.5 Ordering
2 Compiler Issues
2.1 Command Line Tool Setup
2.2 Command Line Batch Files
2.3 Command Line Makefiles
2.4 Compiling Using an IDE
3 Supported Compilers
3.1 Microsoft C/C++
3.2 Microsoft Visual C/C++
3.3 Borland C/C++
3.4 Borland Turbo C/C++ for Windows
3.5 Borland C++ Builder
3.6 Watcom C/C++
3.7 Lcc-Win32 C/C++
4 Compiling Example Programs
4.1 Static Libraries
5 Example Programs
5.1 HOST
5.2 SFINGR, AFINGR, CFINGR, and FINGER
5.3 FROM
5.4 MAIL
5.5 FTP
5.6 NEWS
5.7 VIEW
5.8 WHO_C and WHO_S
5.9 BCAST
5.10 ECHO_S and ECHO_C
5.11 BCB_PRJ
5.12 EMAIL
5.13 CFTP
5.14 TELNET
5.15 UECHOC and UECHOS
5.16 PING
5.17 CFGR_S
6 UUENCODE and MIME Support
6.1 UUENCODE and UUDECODE
6.2 64ENCODE and 64DECODE
7 Summary
7.1 Revision History

1 Introduction

The Winsock Interface Library for C/C++ (WIL4C) is a function library that simplifies Winsock programming and provides support for the most common Internet protocols such as DNS (Domain Name System), Finger, SMTP (Simple Mail Transport Protocol), POP3 (Post Office Protocol Version 3), FTP (File Transfer Protocol), NNTP (Network News Transport Protocol), and HTTP (Hypertext Transfer Protocol).

Winsock network programming is not easy. Because of this, the primary purpose in designing WIL was to simplify Winsock programming.

Winsock simplification is accomplished by:

  1. Handling details like converting from host byte order to network byte order (and vice versa) as necessary automatically.
  2. Handling the creation and manipulation of Winsock data structures automatically.
  3. Providing a straight forward interface, using only necessary arguments.
  4. Providing more powerful functions, which may perform multiple Winsock functions.

The WIL can be called from any program capable of calling Windows API functions, such as Delphi and Visual Basic.

Support for the most common Internet protocols is also provided by the ASYNC.C functions, which can transmit commands and receive responses as used by these protocols.

Lastly, a good selection of example programs is provided, covering the major Internet protocols. The example programs are designed to demonstrate how to use the WIL library functions. One of the best ways to learn Winsock programming is to study these examples.

The shareware and registered versions are identical except that the shareware version displays the "shareware" screen at startup and every 20 minutes thereafter. Of course, the registered version does not display the shareware screen. The registered version also includes source code.

1.1 Documentation Set

The complete set of documentation consists of three manuals in three formats. This is the first manual (WIL4C) in the set.

Each manual comes in three formats:

1.2 Example Program

This simple program (WILVER.C) is a win32 console mode program that displays the WIL version number and build number, as found in WIL32.DLL. It does not require a TCP/IP connection.

#include <windows.h>
#include <winsock.h>
#include <stdio.h>
#include <stdlib.h>
#include "wil.h"
void main(void)
{int Code;
 int Version;
 int Build;
 /* attach WINSOCK */
 printf("WIL Version Program.\n");
 Code = wilAttach();
 if(Code<0)
   {printf("Cannot attach WIL\n");
    exit(1);
   }
 /* get the version number form the DLL */
 Version = wilDebug(WIL_GET_VERSION);
 /* get the build number from the DLL */
 Build = wilDebug(WIL_GET_BUILD);
 printf("WIL32 Version: %1d.%1d.%1d Build %d\n",
       0x0f&(Version>>8),0x0f&(Version>>4),0x0f&Version,Build);
}

1.3 Installation

  1. Before installation of WIL4C, your Windows C/C++ compiler should already be installed on your system and tested. In particular, include command line tools when installing your compiler if you want to compile using command line makefiles. If you need help with makefiles, see MAKEFILE.TXT.
  2. Create your project directory, copy the zip-file, then unzip.
  3. Run the INSTALL program.

The INSTALL batch file must be run to copy the proper DLL's for your compiler. All recent WIN32 C/C++ compilers support the "declspec" keyword. Microsoft VC (version 4.0 and up), Borland (version and up), Watcom (version 11.0 and up), and Lcc-Win32 compilers support the "declspec" keyword.

If you have an older Win32 compiler, you can choose to install native mode DLLs. Run the INSTALL installation program, which will copy the proper LIB's and DLL's.

Choose INSTALLU for Microsoft Visual C/C++, Borland C/C++ and later, Borland C++ Builder, Watcom C/C++ version 11.0 and later, and Lcc-Win32.

1.4 Uninstalling

Uninstalling WIL4C is very easy. WIL does NOT modify the registry. First, delete the WIL project directory created when installing WIL4C. Second, delete WIL16.DLL and WIL32.DLL from your Windows directory, typically C:\WINDOWS for Windows 3.1/95/98 or C:\WINNT for Windows NT. That's it!

1.5 Ordering

See Section-1.2 in the WIL User's Manual (WIL_USR) for information on ordering.


2 Compiler Issues

In order to compile from the command line, command line compiler tools must be set up properly.

2.1 Command Line Tool Setup

For all compilers, your path should point to the compiler BIN directory. For example, to add "C:\BC50\BIN" to your existing path, use

PATH C:\BC50\BIN;%PATH%

2.1.1 Microsoft

Set LIB and INCLUDE environment variables. For example,

SET INCLUDE=C:\MSVC\INCLUDE
SET LIB=C:\MSVC\LIB

2.1.2 Borland

Check that TURBOC.CFG, BCC32.CFG, TLINK.CFG, and TLINK32.CFG all have the correct information in them, as they should have when your compiler was installed.

Set the INCLUDE environment variables. For example,

SET INCLUDE=C:\BC50\INCLUDE

BRCC doesn't use any *.CFG files, but will use INCLUDE if set as above.

If "SET LIB=" is used, it must point to Borland’s LIB directory. Assuming that TURBOC.CFG is correct, it is best to clear the LIB environment variable with

SET LIB=

2.1.3 Watcom

Set the WATCOM environment variables to point to your compilers include (H) and BIN directories. For example,

SET INCLUDE=C:\WC11\H;C:\WC11\H\NT
SET WATCOM=C:\WC11
SET EDPATH=C:\WC11\EDDAT
SET WWINHELP=E:\BINW

2.1.4 Lcc-Win32

The LCC environment variables are set like the others. For example,

SET INCLUDE=C:\LCC\INCLUDE
SET LIB=C:\LCC\LIB


2.2 Command Line Batch Files

If your compiler installation includes command line tools, then all of the example programs can be compiled directly from the command line. These same compiler commands can also be placed in a batch file.

2.3 Command Line Makefiles

Command line makefiles originated on UNIX systems. They are the standard way that C/C++ programs are constructed in command line environments. The advantage of makefiles (as compared to an integrated development environment) is that all compiler switches are coded within the makefile and the makefile can be run with a single keystroke.

Makefiles are provided for Microsoft, Borland, and WATCOM command line compilers.

2.4 Compiling Using an IDE

All current windows compilers have an "Integrated Development Environment" (IDE) for building application programs in the Windows environment. Since there is no standard format for IDE project files, file names must be entered into the IDE from the keyboard.

Note that not only do IDE's vary between the different compiler manufacturers, but they also vary from version to version for the same compiler.

Creating a project makefile for the examples that have only command line makefiles is fairly straight forward. All of the IDE's use the concept of a file hierarchy. For example, the WILVER example program file hierarchy in the IDE (for 32-bit) should look like:

WILVER.EXE

+++ WILVER.C
+++ WIL32.LIB

Replace WIL32.LIB above with WIL16.LIB for 16-bit applications, with WIL32BCB.LIB if using Borland C++ Builder, and with WIL32LCC.LIB if using Lcc-Win32.

The order of the files is not significant. Also refer to the sections on individual IDE's that follow this section.

3 Supported Compilers

WIL4C has been tested with Microsoft C/C++, Microsoft Visual C/C++, Borland C/C++ , Borland C++ Builder, Borland Turbo C/C++, Watcom C/C++, and Lcc-Win32. Other Windows C/C++ compilers may work as well.

3.1 Microsoft C/C++

Note: See the next section for Microsoft Visual C/C++.

Microsoft C/C++ programs can be compiled from either the command line or from within the Microsoft development environment.

The last Win16 Microsoft compiler is version 1.52. Install with "INSTALL 16" in order to compile Win16 applications. For version of Microsoft C/C++ preceding Microsoft Visual C/C++, install with "INSTALL M".

3.1.1 Microsoft Command Line Makefiles

All Microsoft Win16 makefiles end with "16._m_". Note that many of the example program are console mode programs, and cannot be compiled as Win16 programs since Win16 does not support console mode. To compile, use the Microsoft NMAKE utility:

NMAKE -f HOST16._M_
NMAKE -f FTP16._M_
NMAKE -f FROM16._M_

WIL can be used with Microsoft Foundation Class (MFC) programs. Use the MFCPGM16.MAK makefile to compile the MFC_PGM example program.

NMAKE -f MFCPGM16.MAK

3.1.2 Microsoft IDE

To create a new project, choose "Project", then "New". Select Win16 [or Win32] as the target. A dialog box will then pop up into which the project file names are entered.

3.2 Microsoft Visual C/C++

Microsoft Visual C/C++ programs can be compiled from either the command line or from within the Microsoft development environment. All MSVC programs are Win32 only.

In order to use WIL with MSVC, install using "INSTALL U".

3.2.1 Microsoft Command Line Makefiles

Programs can be compiled using command line makefiles. All Microsoft Win16 command line makefiles end with "16._m_" while Win32 command line makefiles end with ’32._m_". To compile using a makefile, use the Microsoft NMAKE utility. For example,

NMAKE -f FROM16._M_
NMAKE -f FROM32._M_

WIL can be used with Microsoft Foundation Class (MFC) programs. Use the MFCPGM32.MAK makefile to compile the MFC_PGM example program.

NMAKE -f MFCPGM32.MAK

3.2.2 Microsoft Developer Studio

To open an existing project, choose "File", then "Open Workspace", and then select "Makefiles" from the list of file types. Several of the example programs have Microsoft Visual Studio C/C++ makefiles, ending with ".MAK" , such as

from32.mak
wilver32.mak
quick32.mak

To create a new project in MSVC 4.0, choose "File", then "New", then "Project Workspace". Select "Application" or "Console Application" for "Type:" and your project name for "Name:". Choose Win32 for platform. Then select "Create". Select "Insert", then "Files into Project". Add all filenames including any resource file (.RC) and WIL32.LIB. Lastly, select "Build", then "Rebuild All".

To create a new project in MSVC 5.0, choose "File", then "New", then "Win32 Application" or "Win32 Console Application " and your project name. Check "Create new workspace Select "Project", then "Add to Project". Add all filenames including any resource file (.RC) and WIL32.LIB. Lastly, select "Rebuild All".

Creating a new project in MSVC 6.0 follows the same logic as for MSVC 5.0.

3.3 Borland C/C++

Borland C/C++ programs can be compiled from either the command line or from within the Borland development environment.

In order to use WIL with Borland C/C++ version 5.0 or later, install using "INSTALL U". To use with Borland version 4.0 or 4.5, install with "INSTALL B".

3.3.1 Borland Command Line Makefiles

Programs can be compiled using command line makefiles. All Borland Win16 command line makefiles end with "16._b_" while Borland Win32 command line makefiles end with ’32._b_". To compile using a makefile, use the Borland MAKE utility. For example,

MAKE -f AFINGR16._B_
MAKE -f AFINGR32._B_

MAKE -f FROM16._B_
MAKE -f FROM32._B_

3.3.2 Borland IDE

To create a new project, first turn off LINKER case sensitivities: Choose "Options", "Projects", "Linker", "General". Turn off the "case sensitive link" and "case sensitive exports and imports" boxes.

Next, choose "Project", then "New Project". Use the INS (Insert) key to pop up a dialog box into which the project file names are entered.

Select "GUI" or "Console" for the "Target Model:" Only "Runtime" and "Dynamic" should be checked for "Standard Libraries:"

NOTE1
If, after linking in the IDE, you get unresolved external references to the library functions in which each function name is all upper case, then you have NOT turned off case sensitivity as described above.
NOTE2
If you get errors compiling the windows header file "WINDOWS.H", turn on "Borland Extensions" in "Options", "Project", "Compiler", "Source".

3.4 Borland Turbo C/C++ for Windows

Borland Turbo C/C++ for Windows does not have command line tools, so all programs must be compiled from the Turbo C/C++ integrated environment.

Follow the same directions as above (Borland IDE), except that the "Target Model:" can be any listed.

3.5 Borland C++ Builder

Borland C++ Builder does not have command line tools, so all programs must be compiled from the Borland C++ Builder integrated environment. Compile the BCB example program QM_PRJ with QM_PRJ.MAK if running BCB version 1 through BCB version 3, and compile with QM_PRJ.BPR if running BCB version 4 or above.

To load the QM_PRJ example project, Choose "File" / "Open Project" on the menu bar. Load QM_PRJ.MAK (or QM_PRJ.BPR). Then, choose "Build All" from "Project" to create the executable. Note that WIL32BCB.LIB is the LIB file used with Borland C++ Builder.

3.6 Watcom C/C++

Watcom C/C++ programs can be compiled from either the command line or from within the Watcom development environment.

In order to use WIL with Watcom C/C++ version 11.0 and later, install using "INSTALL U". To use Watcom version 10.5 or 10.6, install with "INSTALL W".

Watcom cannot create Win16 Winsock programs.

3.6.1 Watcom Command Line Makefiles

Win32 programs can be compiled using command line makefiles. All Watcom command line makefiles end with "32._w_" for Win32 makefiles. To compile using a makefile, use the Watcom WMAKE utility. For example,

WMAKE -f AFINGR32._W_
WMAKE -f FROM32._W_

Win32 programs can also be compiled using command line batch files

3.6.2 Watcom IDE

To create a new project, choose "File", then "New Project". Enter the project name and then choose Win32 as the target. Use the INS (Insert) key to pop up a dialog box into which the project file names are entered.

Select "Options" from the main window, then "C Compiler Switches", then "10". Memory Models and Processor Switches". Check "80386 Stack based calling [-3s]", then check "32-bit Flat model [-mf]".

3.7 Lcc-Win32 C/C++

Lcc-Win32 C/C++ programs can be compiled from either the command line or from within the development environment.

In order to use WIL with Lcc-Win32 C/C++, install using "INSTALL U".

Lcc-Win32 is a freeware C compiler developed and distributed by Jacob Navia at the University of Virginia at

http://www.cs.virginia.edu/~lcc-win32/


To use our DLLs with Lcc-Win32, you must link with WIL32LCC.LIB. This file can also be re-created using the Lcc-Win32 utility BUILDLIB.

buildlib wil32.lcc wil32lcc.lib

Then, compile and link as normal. For example, to compile the CFINGR console mode example program,

lcc -DWIN32 cfingr.c
lcc -DWIN32 str.c
lcc -DWIN32 cons.c
lcclnk cfingr.obj str.obj cons.obj wil32lcc.lib -subsystem:console

To compile the GUI mode example FROM,

lcc -DWIN32 about.c
lcc -DWIN32 async.c
lcc -DWIN32 readini.c
lcc -DWIN32 from.c
lcc -DWIN32 paint.c
lcc -DWIN32 str.c
lrc from.rc
lcclnk from.obj about.obj async.obj readini.obj paint.obj str.obj wil32lcc.lib from.res -subsystem:windows

See CFINGR32.BAT for an example of a console mode command line batch file and FROM32.BAT for an example of a GUI mode command line batch file.

4 Compiling Example Programs

4.1 Static Libraries

The registered user can also statically link WIL16.OBJ or WIL32.OBJ rather than making calls to the DLL's. For an example, see the Microsoft command line makefile STAT32S._M_. These files are not available in the shareware version.

To create an application which links WIL16.OBJ or WIL32.OBJ statically:

  1. Install with "INSTALL U".
  2. All application code that includes WIL.H must define STATIC_LIBRARY before including WIL.H
  3. Your application must link with WINSOCK.DLL (for WIN16) or with WSOCK32 (for WIN32) .

If using Microsoft Developer Studio, make these changes:

  1. To your project file: Do NOT add WIL32.LIB to your project file.
  2. To the settings: (See "Build Settings" or "Project/Settings") (2a) C/C++ Tab: Add STATIC_LIBRARY to "preprocessor definitions:". (2b) Link Tab: Add wsock32.lib and see32.obj to "object/library modules:".


5 Example Programs

There is a good selection of example programs, covering DNS, Finger, SMTP, POP3, NNTP, FTP, and HTTP. The example programs can be broken down into three classes: (1) Synchronous GUI, (2) Asynchronous GUI, and (3) console mode (which is also synchronous).

5.1 HOST

The HOST program uses the Domain Name System (DNS) to get internet addresses for hosts for which their name is known. HOST can also get port and server information, if available.

5.2 SFINGR, AFINGR, CFINGR, and FINGER

The four finger programs demonstrate the 3 methods of using the WIL4C library. The FINGER protocol is presented in the section on protocols.

SFINGR makes only synchronous function calls. Refer to Section 3.9.1 " Synchronous Programming " in the WIL User’s Manual (WIL_USR) for information on synchronous calls.

AFINGR makes asynchronous function calls. Refer to Section 3.9.2 " Asynchronous Programming " in the WIL User’s Manual (WIL_USR) for information on asynchronous calls.

FINGER makes asynchronous function calls using the ASYNC commands. Refer to Section 3.11 "The ASYNC Functions" in the WIL User’s Manual (WIL_USR) for more information.

CFINGR is the console mode equivalent.

The Finger client program contacts the specified Finger Server and requests information for a particular user. Many hosts do not have finger servers.

You can finger MarshallSoft Computing by specifying (at the prompt) "msc@hiwaay.net".

5.3 FROM

The FROM client program logs onto your POP3 account and checks if you have any waiting mail. If you do, it lists the messages by number along with the "From:" and "Subject:" fields, if any.

In order to use FROM, you must edit the file FROM.INI which contains POP3 server addresses, and login name & password.

For example, suppose your ISP (Internet Service Provider) has host address SUPERSERVE.COM, and your login name is billy. Then FROM.INI may contain:

POP3=mail.superserve.com
USER=billy
PASS=my_password


5.4 MAIL

The mail client program is similar to FROM, except that it can also send, receive, and delete mail.

In order to use MAIL, you must edit the file MAIL.INI which contains SMTP & POP3 server addresses, and login name & password.


SMTP=mail.superserve.com
POP3=mail.superserve.com
USER=billy
FROM=billy@superserve.com
PASS=my_password


MAIL.INI is similar to FROM.INI with the addition of the SMTP server (for sending mail) and your email address (FROM line). In fact, you can also use MAIL.INI for FROM.INI.

See Section 5.9 (BCAST) for a description of the file format for outgoing email messages. Note that the first line must be the destination email address.

5.5 FTP

The FTP (File Transfer Protocol) client program communicates with a FTP server, allowing for the transfer of ASCII and binary files. Refer to Section 4 "Internet Protocols" in the WIL User’s Manual (WIL_USR) for information on the FTP protocol.

You must provide the login name and password in FTP.INI. For example, if your email address is billy@superserve.com, FTP.INI would contain the following for anonymous FTP.

USER=anonymous
PASS=billy@superserve.com

The FTP client program is capable of the following operations:

Command Description

CWD Changes the working directory at the host.

LIST List the contents of the current working directory. ASCII Sets ASCII transfer mode.

BINARY Sets binary transfer mode.

GET Receives specified file from the host.
PUT Sends specified file to the host.

QUIT Quits the FTP session.

Don't forget to set BINARY mode before downloading or uploading a binary file.


5.6 NEWS

The NEWS client program communicates with a NNTP (Network News Transport Protocol) and provides the following functions:

Command         Description
Group/
  List          Lists all groups.
  Select        Selects a group for subsequent processing.
Header/
  GetByNumber     Selects header by number.
  GetCurrent    Selects current header.
  Next          Selects next header.
  Last          Selects last header.
Article/
  GetByNumber     Selects article by number.
  GetCurrent    Selects current article.
  Next          Selects next article.
  Last          Selects last article.
Quit            Quits the NEWS server.
If the user specifies "Group/List", the incoming list of groups is saved in the file NEWS.LST. If the user requests an article by number "Article/GetByNumber", then the article is saved with file extension ".ART". Refer to Section 4.4 "NNTP Protocol" in the WIL User’s Manual (WIL_USR) for information on NNTP.

5.7 VIEW

VIEW is a HTTP client program which requests and displays source code for a specified HTTP web page. VIEW is not a browser! VIEW can be used as the basis for several types of HTTP clients. Some ideas are as follows:
  1. VIEW can be used as the starting point for a web browser. Most of the effort will be in writing the code necessary to interpret the HTML (Hypertext Markup Language) text.
  2. VIEW could also be used as the basis for a "ROBOT" program, that searches for email addresses. This is what some search engines do in order to catalog the web sites on the Internet.
  3. VIEW could also be used as the starting point for a program that connects to a search engine, copying search results for subsequent analysis.

VIEW uses the synchronous style of programming.

5.8 WHO_C and WHO_S

WHO_S is a server program which provides "WHOIS" service for three individuals as requested by the client WHOIS program WHO_C.

After starting the server WHO_S, note the IP address. Next, start the client WHO_C, using the WHO_S server IP address to specify the server. Then, specify one of the three people in the WHOIS database: Mike, Pam, or Lauren.

The purpose of the WHOIS programs is to demonstrate how to write a simple Internet server and matching client.

Also see CWHO_S program, which is the console mode equivalent of WHO_S.

5.9 BCAST

BCAST is a SMTP client that emails a file to each address specified in a list, such as emailing our newsletter to our customers.

Several pieces of information must be in the BCAST.INI file:

SMTP=your_SMTP_server_address
FROM=your_email_address
RCPT=file_of_email_addresses
MAIL=file_to_email

Outgoing email messages should be ASCII text files formatted as:

Line 1: Email address of destination (MAIL program only).

Line 2: "To: " header line.

Line 3: "From: " header line.

Line 4: "Subject: " header line.

Line 5: Blank line.

Line 6 to last_line: ASCII email message.

Example outgoing email message:

mike@marshallsoft.com

   To: mike@marshallsoft
   From: pam@traveller.com
   Subject: Test message
The mail destination address must be the 1st line for email being sent with the MAIL example program. The "To:", "From:", and "Subject:" fields are optional. There should be a blank line before the body of the message. [7/25/97].

5.10 ECHO_S and ECHO_C

An echo server is a program which echoes anything sent to it back to the sender. The connection is closed by the client. It’s primary purpose is as a diagnostics tool using well known port 2.

ECHO_S is a Win32 console mode echo server, capable of processing multiple concurrent sessions. ECHO_C is a Win32 console mode echo client.

5.11 BCB_PRJ

The BCB_10 (for BCB version 1.0 through 3.0) and BCB_40 (for BCB version 4.0 and above) examples are console mode Borland C Builder Finger C++ programs. They operate like the other Finger examples. You should install the "universal" version of WIL32.DLL (INSTALL U).

The LIB file can be reconstructed from the installed DLL with:

implib wil32bcb.lib wil32.dll

5.12 EMAIL

EMAIL is a Win32 console mode program that emails a file. The email address and filename are taken from the command line.

5.13 CFTP

The CFTP program is similar to the FTP example, except it is written in Win32 console mode.

5.14 TELNET

The Win32 console mode program TELNET.C implements a bare bones TELNET "Network Virtual Terminal".

5.15 UECHOC and UECHOS

UECHOC and UECHOS are identical to ECHOC and ECHOS except that they use UDP packets rather than TCP packets. Also see 5.10 above and 5.17 below.

5.16 PING

PING is a WIN32 console mode program that uses raw sockets to "ping" an IP address. Note that the time displayed in the example program PING includes connecting and closing the connection.

5.17 CFGR_S

CFGR_S is a Win32 console Finger multi-threaded server. A thread is started to handle each connection accepted by CFGR_S. Also see 5.15 above.

6 UUENCODE and MIME Support

6.1 UUENCODE and UUDECODE

The stand alone programs UUENCODE.C and UUDECODE.C are capable of encoding and decoding "UUENCODED" mail attachments.

These two programs are coded for compilation under DOS but can easily be modified to be coded as Win32 CONSOLE mode programs.

For example, to encode file TESTER.EXE as TESTER.UU, type

UUENCODE TESTER.EXE TESTER.UU

To decode TESTER.UU, type

UUDECODE TESTER.UU

The encoding & decoding functions EncodeUU() and DecodeUU() are also present in the WIL.

UUENCODE (and UUDECODE) have been superseded by MIME encoding, particularly "base 64" MIME encoding. Nevertheless, some email clients cannot handle MIME.

Refer to UUCODER.C, UUENCODE.C, and UUDECODE.C

6.2 64ENCODE and 64DECODE

The stand alone programs 64ENCODE.C and 64DECODE.C are capable of encoding and decoding Base 64 MIME mail attachments.

For example, to encode file TESTER.EXE as TESTER.64, type

64ENCODE TESTER.EXE TESTER.64

To decode TESTER.64, type

UUDECODE TESTER.64

These two programs are coded for compilation under DOS but can easily be modified to be coded as Win32 CONSOLE mode programs.

The encoding & decoding functions Encode64() and Decode64() are also present in the WIL.

Refer to 64CODER.C, 64ENCODE.C, and 64DECODE.C.

7 Summary

7.1 Revision History

Version 1.0: 28 July, 1997.

Version 2.0: 14 February 1998.

Version 3.0: 17 November 1999.

Version 3.1: 4 April 2000.