apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yogesh Test <ychaturv...@gmail.com>
Subject apr_proc_create() do not return response string
Date Tue, 13 May 2008 09:12:40 GMT

hi,

    I am using piping and call a Bind utility nsupdate to update a Dns
dynamically. When i call this utility exe on command prompt it display me
for section on condole window :
 
1. Header section
2. Update section 
3. TSIG section
3. Reply section

Now i implement apr_proc() to call the same nsupdate exe(tcp request to
update a dns).
But i am unable to get the reply section. What may be the problem , i am
pasting my code below:

/////////////////////
apr_procattr_t *pattr;
aprStatus = apr_procattr_create(&pattr, tempPool);
aprStatus = apr_procattr_io_set(pattr, APR_FULL_BLOCK, APR_FULL_BLOCK,
APR_NO_PIPE);
aprStatus = apr_procattr_cmdtype_set(pattr, APR_PROGRAM_ENV);
aprStatus = apr_proc_create(&proc, nsupdateCommand.c_str(), (const char*
const*)argv, NULL, (apr_procattr_t*)pattr, tempPool);
int isContinue = 1 ;
while (isContinue)
{
char buf[BUFSIZE];
/* read the command's output */
aprStatus = apr_file_gets(buf, sizeof(buf), proc.out);
if (APR_STATUS_IS_EOF(aprStatus)) 
{
 break;
}
if (is_firstline) 
{/* skip the first line */
is_firstline = FALSE;
continue;
}
outPutString = outPutString + buf;
}
apr_file_close(proc.out);  //close file

cout << outPutString ;

/////////////////



Thanks

-- 
View this message in context: http://www.nabble.com/apr_proc_create%28%29--do-not-return-response-string-tp17204324p17204324.html
Sent from the APR Dev (Apache Portable Runtime) mailing list archive at Nabble.com.


Mime
View raw message