proggybilly
Programmer
I am trying to write a small script that will replace what is in a file with new data.
i have the file opened and i can display it on the screen
what I need to do is search the file for the instance of "EXT2IP" which actually reads as (#EXT2IP="192.168.1.1").
I need to find that instance, strip off the # (if exists) and then replace the IP address with an IP address I will pull from an array.
Your help is greatly appreciated.
i have the file opened and i can display it on the screen
Code:
int main()
{
string line2;
ifstream file2;
file2.open("/etc/asterisk/rc.conf");
if(!file2){
printf("File rc.conf not open");
}
while(!file2.eof()){
getline(file2,line2);
cout<<line2<<endl;
}
}
what I need to do is search the file for the instance of "EXT2IP" which actually reads as (#EXT2IP="192.168.1.1").
I need to find that instance, strip off the # (if exists) and then replace the IP address with an IP address I will pull from an array.
Your help is greatly appreciated.