shidlingayya -
Joined: 30 Apr 2008 Posts: 1
|
Posted: Wed Apr 30, 2008 12:53 pm Post subject: Dear All... |
|
|
Dear All
The My problem is :-
1. I have one directory called CUBAS_ComStack_COMMON
2. I have to separate .C and .H files
3. The .C files contains Upper case preprocessors(# include "CAN.h") I have to convert this into lower case (# include "can.h")
So for i have done following code but i am not getting correct result..any body help me greatly appriciated..
Code: |
use File::Spec::Functions qw/rel2abs splitpath catfile/;
use strict;
sub mmm_good {
my $d = rel2abs($_[0]);
mkdir $d unless -e $d;
die unless -d $d;
return $d;
}
my(%dirs);
$dirs{c} = mmm_good('source');
$dirs{h} = mmm_good('header');
for my $path (map((glob $_), @ARGV) {
next unless $path =~ /.([chCH])$/ && -r $path;
my $ext = lc $1;
open my $in, "<", $path;
open my $out, ">", catfile($dirs{$ext}, (splitpath($path))[2]);
while(my $line = <$in>) {
$line = lc $line if /^\w*#include/;
print $out $line;
}
close $out;
close $in;
}
|
I am using windows 2000 operating system and VC++ compiler |
|