79 lines
4.9 KiB
HTML
79 lines
4.9 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="reference" />
|
||
|
<meta name="DC.Title" content="Write a generic iSeries Access for Windows application" />
|
||
|
<meta name="abstract" content="Generic applications allow maximum portability because the same source code can be compiled for OEM, ANSI, and Unicode." />
|
||
|
<meta name="description" content="Generic applications allow maximum portability because the same source code can be compiled for OEM, ANSI, and Unicode." />
|
||
|
<meta name="DC.Relation" scheme="URI" content="rzaikcaexpressprogstd.htm" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 1999, 2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 1999, 2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="writegencaapp" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Write a generic iSeries Access for Windows application</title>
|
||
|
</head>
|
||
|
<body id="writegencaapp"><a name="writegencaapp"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<h1 class="topictitle1">Write a generic iSeries Access for Windows application</h1>
|
||
|
<div><p>Generic applications allow maximum portability because the same
|
||
|
source code can be compiled for OEM, ANSI, and Unicode.</p>
|
||
|
<div class="section"><p>Generic applications are built by specifying different preprocessor
|
||
|
definitions, and by using the generic version of the iSeries™ access for Windows<sup>®</sup> APIs
|
||
|
(the ones without the "A" or "W" suffixes). Following is a short list of guidelines
|
||
|
for writing a generic application: </p>
|
||
|
<ul><li>Instead of including the usual <string.h> for manipulating strings,
|
||
|
include <TCHAR.H>.</li>
|
||
|
<li>Use generic data types for characters and strings. Use 'TCHAR' for 'char'
|
||
|
in your source code.</li>
|
||
|
<li>Use the _TEXT macro for literal characters and strings. For example, <samp class="codeph">TCHAR
|
||
|
A[]=_TEXT("A Generic String")</samp>.</li>
|
||
|
<li>Use generic string manipulation functions. For example, use <samp class="codeph">_tcscpy</samp> instead
|
||
|
of <samp class="codeph">strcpy</samp>.</li>
|
||
|
<li>Be especially careful when using the 'sizeof' operator - always remember
|
||
|
that a Unicode character occupies two bytes. When determining the number of
|
||
|
characters in a generic TCHAR array A, instead of the simple <samp class="codeph">sizeof(A)</samp>,
|
||
|
use <samp class="codeph">sizeof(A)/sizeof(TCHAR)</samp>.</li>
|
||
|
<li>Use proper preprocessor definitions for compilation. When compiling your
|
||
|
source for Unicode in Visual C++, you should also use the preprocessor definitions <samp class="codeph">UNICODE</samp> and <samp class="codeph">_UNICODE</samp>.
|
||
|
Instead of defining <samp class="codeph">_UNICODE</samp> in the MAK file, you may want
|
||
|
to define it at the beginning of your source code as: <pre>#ifdef UNICODE
|
||
|
#define _UNICODE
|
||
|
#endif</pre>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="section"><p>For a complete description of these guidelines, see the following
|
||
|
resources:</p>
|
||
|
</div>
|
||
|
<div class="section"> <ol><li>Richter, J. <em>Advanced Windows: The Developer's Guide to the
|
||
|
Win32 API for Windows NT<sup>®</sup> 3.5 and Windows 95</em>, Microsoft<sup>®</sup> Press,
|
||
|
Redmond, WA, 1995.</li>
|
||
|
<li>Kano, Nadine <em>Developing International Software for Windows 95
|
||
|
and Windows
|
||
|
NT<sup>®</sup>: a handbook for software design</em>, Microsoft Press, Redmond, WA, 1995.</li>
|
||
|
<li>Microsoft <a href="http://support.microsoft.com/support/" target="_blank">Knowledge
|
||
|
Base</a><img src="www.gif" alt="Link outside Information Center" /> articles</li>
|
||
|
<li><a href="http://msdn.microsoft.com/library/default.asp" target="_blank">MSDN Library</a><img src="www.gif" alt="Link outside Information Center" /></li>
|
||
|
</ol>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div>
|
||
|
<div class="familylinks">
|
||
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="rzaikcaexpressprogstd.htm" title="Most of the iSeries Access for Windows C/C++ APIs that accept string parameters exist in three forms: OEM, ANSI, or Unicode.">OEM, ANSI, and Unicode considerations</a></div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</body>
|
||
|
</html>
|