Condividi tramite


_PutStr( ) API Library Routine

Displays a null-terminated string at the output position in the current output window in its normal attribute (color 0).

void _PutStr(char FAR *str)
char FAR *str;               /* String to display. */

Remarks

_PutStr( ) treats special characters such as newline, carriage return, and bell as control characters and doesn't display them on the screen.

For more information on how to create an API library and integrate it with Visual FoxPro, see Accessing the Visual FoxPro API.

Example

The following example uses _PutStr( ) to display its character type parameter in uppercase on the screen.

Visual FoxPro Code

SET LIBRARY TO PUTSTR  
= XUPPER("upper")  && displays "UPPER" on the screen

C Code

#include "pro_ext.h"

void NullTerminate(Value FAR *cVal)
{
   if (!_SetHandSize(cVal->ev_handle, cVal->ev_length + 1))
   {
      _Error(182); // "Insufficient memory"
   }
   ((char FAR *) _HandToPtr(cVal->ev_handle))[cVal->ev_length] = '\0';
}

FAR Example(ParamBlk FAR *parm)
{
   char FAR *pString;
   int i;

   NullTerminate(&parm->p[0].val);
   pString = _HandToPtr(parm->p[0].val.ev_handle);
   for (i = 0; i < parm->p[0].val.ev_length; i++)
   {
      if ('a' <= *pString && *pString <= 'z')
      {
         *pString += ('A' - 'a');
      }
      pString++;
   }
   _HLock(parm->p[0].val.ev_handle);
   _PutStr(_HandToPtr(parm->p[0].val.ev_handle));
   _HUnLock(parm->p[0].val.ev_handle);
}

FoxInfo myFoxInfo[] = {
   {"XUPPER", (FPFI) Example, 1, "C"},
};
FoxTable _FoxTable = {
   (FoxTable FAR *) 0, sizeof(myFoxInfo)/sizeof(FoxInfo), myFoxInfo
};

See Also

_PutChr( ) API Library Routine | _PutValue( ) API Library Routine | Accessing the Visual FoxPro API | _WPutChr( ) API Library Routine | _WPutStr( ) API Library Routine