paulwhelan
asked on
system call
i try to use syscall('');
and system('');
in a script but cant get them to work
how would i do a system call to copy the contents
of one file onto the end of another file?
thanks
paul
and system('');
in a script but cant get them to work
how would i do a system call to copy the contents
of one file onto the end of another file?
thanks
paul
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
jhurst,
can you tell me what the differnce between your solution and my last proposal is?
Tobias
can you tell me what the differnce between your solution and my last proposal is?
Tobias
The difference is that my solution does not require that cat be available, as for example it is not in DOS or on any system where the security settings are such that the cat is not available even though it exists.
Hmmm - I don't see any 'cat' appearing in this solution:
open(ONEFILE,"<onefile")|| die "Can't open onefile - $!";
open(OTHERFILE">>otherfile ") || die "Can't open otherfile - $!";
while(<ONEFILE>) {
print OTHERFILE $_;
}
close(OTHERFILE);
close(ONEFILE);
Time to clean my glasses ...
Tobias
open(ONEFILE,"<onefile")||
open(OTHERFILE">>otherfile
while(<ONEFILE>) {
print OTHERFILE $_;
}
close(OTHERFILE);
close(ONEFILE);
Time to clean my glasses ...
Tobias
neither do I. Only in the three other ones. Actually, given that I do not see why you did not post it as an answer.
Anyway, if Paul thinks it works and awards points, and you need them. I will be happy to post a question for thoellri that gives him this number of points.
Anyway, if Paul thinks it works and awards points, and you need them. I will be happy to post a question for thoellri that gives him this number of points.
ASKER
i dont know who to give the points to
both answers work!
thanks guys
paul
both answers work!
thanks guys
paul
ASKER
im really low on points at the moment
so sorry if i can only give some to one....
i used the system("cat onefile >> otherfile");
so i guess the points go to.....
so sorry if i can only give some to one....
i used the system("cat onefile >> otherfile");
so i guess the points go to.....
that may be the better solution, if it works. I was assuming that the
isp would not allow you cat-access.
isp would not allow you cat-access.
A much safer, and universal method is:
open(FILE1,"<filetocopyfro
open(FILE2,">>filetocopyto
while (<FILE1>) #read all lines
{print FILE2 $_; #and copy them
}