my initial thought for this (not having tested this) is that CF by default
runs under the SYSTEM so it wont have a username in its environment, whereas
running the test cpp file you have written is running under the logged on
users environment and so returns a username.  You could try running CF under
a user account and see if that returns a username.

HTH

-----Original Message-----
From: Joseph Fry [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 22, 2003 14:05
To: CF-Talk
Subject: CFMX 6.1 and CFX play nice?

Hello all,

I wrote a simple .cpp file that gets a windows username using:
char *username = getenv("USERNAME");
cout << username;

The result is the username that i want, however when i create this file as a
cfx and access it from cold fusion i get a NULL value. Is this a CFMX issue
with anything non-string based sent back to it, meaning that when I send a
regular string value, the output .cfm file prints the value to the screen.
However when i send the generated value listed below, I get an error.  Can
anyone help me? I followed the instructions on how to create a cfx file, but
nothing gives me a simple explanation on how to just return a simple char
value.

This is what i entered:

#include....
...
void ProcessTagRequest( CCFXRequest* pRequest )
{
try
{
char *varUserName = getenv("USERNAME");
pRequest->SetVariable( "varTest", varUserName);
...
}
}

Thanks,
Joe

p.s. using CFMX 6.1
  _____  


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to