diff options
author | Hanoh Haim <hhaim@cisco.com> | 2016-02-15 14:19:03 +0200 |
---|---|---|
committer | Hanoh Haim <hhaim@cisco.com> | 2016-02-15 14:19:03 +0200 |
commit | f6901ca1f2cca419eeba2e1a35a38fe06a6650be (patch) | |
tree | aa998cd7f1005cc3efa192cc88c38b7d5dfcb650 /src/common | |
parent | 1f60016f591ebd2e260e501c8c5da10c11d0c7ad (diff) |
add support for dp mac replace mode-golden were changed
Diffstat (limited to 'src/common')
-rwxr-xr-x | src/common/captureFile.cpp | 27 | ||||
-rwxr-xr-x | src/common/captureFile.h | 2 |
2 files changed, 29 insertions, 0 deletions
diff --git a/src/common/captureFile.cpp b/src/common/captureFile.cpp index 00625181..e73c37ad 100755 --- a/src/common/captureFile.cpp +++ b/src/common/captureFile.cpp @@ -157,6 +157,33 @@ bool CCapPktRaw::Compare(CCapPktRaw * obj,int dump,double dsec){ } } +#define CPY_BUFSIZE 1024 + +bool CErfCmp::cpy(std::string src,std::string dst){ + + char mybuf[CPY_BUFSIZE] ; + FILE *ifd = NULL; + FILE *ofd = NULL; + ifd = fopen( src.c_str(), "rb" ); + ofd = fopen( dst.c_str(), "w+"); + assert(ifd!=NULL); + assert(ofd!=NULL); + + int n; + while ( true){ + n = fread(mybuf, sizeof(char), CPY_BUFSIZE ,ifd); + if (n>0) { + fwrite(mybuf, sizeof(char),n,ofd); + }else{ + break; + } + } + + fclose(ifd); + fclose(ofd); + return true; +} + bool CErfCmp::compare(std::string f1, std::string f2 ){ diff --git a/src/common/captureFile.h b/src/common/captureFile.h index 16a6120b..3be83432 100755 --- a/src/common/captureFile.h +++ b/src/common/captureFile.h @@ -279,6 +279,8 @@ public: d_sec=0.001; } bool compare(std::string f1, std::string f2 ); + + bool cpy(std::string src,std::string dst); public: bool dump; double d_sec; |