INT GetProgramText( |
|
UINT nClientId, |
|
|
LPTSTR lpszBuffer, |
|
|
INT nMaxLength |
|
); |
INT GetProgramText( |
|
UINT nClientId, |
|
|
CString& strBuffer |
|
); |
Return a copy of the standard output from a CGI program in a
string buffer.
Parameters
- nClientId
- An unsigned integer which uniquely identifies the client
session.
- lpszBuffer
- A buffer that will contain the output from the last
program executed by the client as a string. If this parameter
is NULL, the method will return the number of bytes of characters that was
output by the program, not including a terminating null character.
An alternate version of this method accepts a CString
object if it is available.
- nMaxLength
- The maximum number of bytes that can be copied into the buffer.
If the lpszBuffer parameter is NULL, this value should be zero.
Return Value
If the method succeeds, the return value is the number of
characters copied into the specified string buffer, not including the terminating
null character. If the client ID does not specify a valid
client session, the method will return zero. If the client has not
executed any programs, the return value will be zero.
Remarks
The GetProgramText method is used to obtain a copy of
the output generated by a CGI program. To determine the number of
characters of output available to read, call this method with the
lpszBuffer parameter as NULL and the nMaxLength
parameter with a value of zero. The return value will be the
number of characters that were output by the program. If the
application dynamically allocates the string buffer, make sure
that it allocates an extra character for the terminating null
character.
This method will only return textual output from the program and
any non-printable control characters and the escape character will be
replaced with a space. To obtain the unfiltered output from the
program, use the GetProgramOutput method. If the program
outputs a response header block, this will be included in the string
buffer.
This method should only be used within an OnExecute event
handler, which occurs after the program has terminated.
Example
CString strBuffer;
if (pHttpServer->GetProgramText(nClientId, strBuffer) > 0)
pEditCtrl->SetWindowText(strBuffer);
Requirements
Minimum Desktop Platform: Windows 7 Service Pack 1
Minimum Server Platform: Windows Server 2008 R2 Service Pack 1
Header File: cstools11.h
Import Library: cshtsv11.lib
Unicode: Implemented as Unicode and ANSI versions
See Also
GetProgramExitCode,
GetProgramOutput,
OnExecute,
RegisterProgram
|