W
wukexin
Help me, good men. I find mang books that introduce bit "mang header
files",they talk too bit,in fact it is my too fool, I don't learn it, I have
do a test program, but I have no correct doing result in any way. Who can
help me, I thank you very very much.
list.cpp(main program)
//--------------------------------------------------------------------------
-
#pragma hdrstop
#pragma argsused
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include "help.h"
#include "file.h"
using namespace std;
int main(int argc, char* argv[])
{
int number=argc;
if(number<1)
{
cout<<"The program run program!"<<endl;
return 0;
}
vector<string> option;
for(unsigned i=1;i<argc;i++)
{
option.push_back(argv);
}
sort(option.begin(),option.end());
//for_each(option.begin()),option.end(),myhelp:rint);
vector<string> filename,pathname;
for(unsigned i=0;i<option.size();i++)
{
using namespace myfile;
if( is_dir(option) )
{
pathname.push_back(option);
}
}
for(unsigned i=0;i<option.size();i++)
{
using namespace myfile;
print(option);
}
return 0;
}
////////////////////////////////////////////////////////////////////////////
/
file.h:
//--------------------------------------------------------------------------
-
#ifndef fileH
#define fileH
namespace myfile
{
using namespace std;
bool is_dir(const string x);
};
#endif
////////////////////////////////////////////////////////////////////////////
/
file.cpp
//--------------------------------------------------------------------------
-
#include <dir.h>
#ifdef fileH
#define fileH
#endif
#include <string>
using namespace std;
bool is_dir(const string x)
{
struct ffblk file;
int done=findfirst(x.c_str(),&file,FA_DIREC);
bool result(false);
if(0==done)
{
result=true;
}
else
{
result=false;
}
return result;
}
////////////////////////////////////////////////////////////////////////////
//
help.h
//--------------------------------------------------------------------------
-
#ifndef helpH
#define helpH
namespace myhelp
{
void print(const string x);
};
#endif
////////////////////////////////////////////////////////////////////////////
/
help.cpp
//--------------------------------------------------------------------------
-
#pragma hdrstop
#include "help.h"
#include <string>
#include <iostream>
using namespace std;
void print(const string x)
{
cout<<x<<endl;
}
////////////////////////////////////////////////////////////////////////////
/
ÕâÊDZàÒë½á¹û:
[C++ Error] help.h(6): E2293 ) expected
Full parser context
list.cpp(7): #include D:\PROGRAM\WUKEXIN\FILE\help.h
help.h(5): namespace myhelp
[C++ Warning] list.cpp(19): W8012 Comparing signed and unsigned values
Full parser context
list.cpp(11): parsing: int cdecl main(int,char * *)
[C++ Error] list.cpp(37): E2268 Call to undefined function 'print'
Full parser context
list.cpp(11): parsing: int cdecl main(int,char * *)
files",they talk too bit,in fact it is my too fool, I don't learn it, I have
do a test program, but I have no correct doing result in any way. Who can
help me, I thank you very very much.
list.cpp(main program)
//--------------------------------------------------------------------------
-
#pragma hdrstop
#pragma argsused
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include "help.h"
#include "file.h"
using namespace std;
int main(int argc, char* argv[])
{
int number=argc;
if(number<1)
{
cout<<"The program run program!"<<endl;
return 0;
}
vector<string> option;
for(unsigned i=1;i<argc;i++)
{
option.push_back(argv);
}
sort(option.begin(),option.end());
//for_each(option.begin()),option.end(),myhelp:rint);
vector<string> filename,pathname;
for(unsigned i=0;i<option.size();i++)
{
using namespace myfile;
if( is_dir(option) )
{
pathname.push_back(option);
}
}
for(unsigned i=0;i<option.size();i++)
{
using namespace myfile;
print(option);
}
return 0;
}
////////////////////////////////////////////////////////////////////////////
/
file.h:
//--------------------------------------------------------------------------
-
#ifndef fileH
#define fileH
namespace myfile
{
using namespace std;
bool is_dir(const string x);
};
#endif
////////////////////////////////////////////////////////////////////////////
/
file.cpp
//--------------------------------------------------------------------------
-
#include <dir.h>
#ifdef fileH
#define fileH
#endif
#include <string>
using namespace std;
bool is_dir(const string x)
{
struct ffblk file;
int done=findfirst(x.c_str(),&file,FA_DIREC);
bool result(false);
if(0==done)
{
result=true;
}
else
{
result=false;
}
return result;
}
////////////////////////////////////////////////////////////////////////////
//
help.h
//--------------------------------------------------------------------------
-
#ifndef helpH
#define helpH
namespace myhelp
{
void print(const string x);
};
#endif
////////////////////////////////////////////////////////////////////////////
/
help.cpp
//--------------------------------------------------------------------------
-
#pragma hdrstop
#include "help.h"
#include <string>
#include <iostream>
using namespace std;
void print(const string x)
{
cout<<x<<endl;
}
////////////////////////////////////////////////////////////////////////////
/
ÕâÊDZàÒë½á¹û:
[C++ Error] help.h(6): E2293 ) expected
Full parser context
list.cpp(7): #include D:\PROGRAM\WUKEXIN\FILE\help.h
help.h(5): namespace myhelp
[C++ Warning] list.cpp(19): W8012 Comparing signed and unsigned values
Full parser context
list.cpp(11): parsing: int cdecl main(int,char * *)
[C++ Error] list.cpp(37): E2268 Call to undefined function 'print'
Full parser context
list.cpp(11): parsing: int cdecl main(int,char * *)