00001
00002
00003
00004 #ifndef CONNECTSTRING_H
00005 #define CONNECTSTRING_H
00006 #include "ocEnc.h"
00007 #include <fstream>
00008 ocEnc conn;
00009 const int encSeed = 787;
00010 const char * filename = "constr";
00011 const char * getConnectstring( const char * use_file = 0 )
00012 {
00013 if(!use_file) use_file = filename;
00014 ifstream in(use_file);
00015 char buf[512];
00016 in.getline (buf,sizeof(buf));
00017 conn = buf;
00018 conn.decode(encSeed);
00019 return conn.c_str();
00020 }
00021 bool setConnectstring( char * r )
00022 {
00023 bool ret = false;
00024 ofstream out(filename);
00025 if(out && r and strlen(r) )
00026 {
00027 conn = r;
00028 conn.encode(encSeed);
00029 out << conn << endl;
00030 ret = true;
00031 }
00032 return ret;
00033 }
00034
00035
00036 #endif