Hi,

I am calling a small C++ executable taking some commad line arguments in the Python. In C++ code i am tring to open a file it works fine if i execute the code form the shell but if i call it through python code the file cannot be opened.

Python Code
*********************************************
#! /usr/bin/env python

import os
import sys


test = ['qtl']
f = open('settings.ini','r')
for line in f.readlines():
        print line
        test.append(line)

f.close()

print test[0]
print test[1]
print test[2]

os.execv("qtl",test)
********************************************

should i use anyother command to rum this "qtl"

C code (qtl.cpp)
********************************************
#include <iostream.h>
#include <stdlib.h>
#include <fstream.h>
int main(int argc, char *argv[])
{

char buffer[256];
char* name;
int number;

//cout << "argc = " <<argc <<endl;
if(argc < 2)
{
cout << "Enter 2 arguments ...."<<endl;
return 0;
}
cout<<"argv[0] "<<argv[0]<<endl;
cout<<"argv[1] "<<argv[1]<<endl;
cout<<"argv[2] "<<argv[2]<<endl;

name =  argv[2];
number = atoi(argv[1]);

cout <<"file name = "<<name<<endl;
ifstream examplefile(name);
cout <<"number is >> "<< number<<endl;

if(!examplefile.is_open())
{
cout <<"problem in openning of file";
return 0;
}

while (examplefile.getline(buffer,256))
cout <<buffer<<endl;

examplefile.close();

return 0;
}

********************************************

Result if i run python code ./run.py
********************************************
-bash-3.00$ ./run.py
12
abc.txt

qtl
12
abc.txt

argv[0] qtl
argv[1] 12
argv[2] abc.txt

file name = abc.txt
number is >> 12
problem in openning of file

********************************************


Thanks in advance

Best Rgards....
Salman Toor.