vincebrown
Technical User
Can someone please show me how to make this script replace '<PreprocessorFlags/>' with '<PreprocessorFlags>U_CPPUNWIND</PreprocessorFlags>'. Thanks.
open FILE, 'C:/cpptest\C++TestFiles\Projects\Hello\Product\ProjectConfig.pcfg';
foreach(<FILE>){
push (@file,$_);
}
close FILE;
unlink 'C:/cpptest\C++TestFiles\Projects\Hello\Product\ProjectConfig.pcfg';
open FILE, '>C:/cpptest\C++TestFiles\Projects\Hello\Product\ProjectConfig.pcfg';
foreach (@file){
if ($_ =~ /(.*)(<PreprocessorFlags\/\>)(.*)/){
print FILE " $1\t$2/U_CPPUNWIND</PreprocessorFlags>$3\n";
}else{
print FILE $_;
}
}
close FILE;
open FILE, 'C:/cpptest\C++TestFiles\Projects\Hello\Product\ProjectConfig.pcfg';
foreach(<FILE>){
push (@file,$_);
}
close FILE;
unlink 'C:/cpptest\C++TestFiles\Projects\Hello\Product\ProjectConfig.pcfg';
open FILE, '>C:/cpptest\C++TestFiles\Projects\Hello\Product\ProjectConfig.pcfg';
foreach (@file){
if ($_ =~ /(.*)(<PreprocessorFlags\/\>)(.*)/){
print FILE " $1\t$2/U_CPPUNWIND</PreprocessorFlags>$3\n";
}else{
print FILE $_;
}
}
close FILE;