Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision 5550635707d249fbddac61f337f123ec13876725)
+++ src/builder.cpp	(revision 5b15abd736e431efbf95ee359dc600e887d01a25)
@@ -748,5 +748,5 @@
   char *ConfigFileName = NULL;
   char *ElementsFileName = NULL;
-  int flag = 1;
+  int flag = 0;
   int Z;
   int j, axis, count, faktor;
@@ -773,4 +773,5 @@
           case 'H':
           case '?':
+            flag=2;
             cout << "MoleCuilder suite" << endl << "==================" << endl << endl;
             cout << "Usage: " << argv[0] << "[-{acepsthH?vfrp}] [further arguments] [config file]" << endl; 
@@ -785,11 +786,11 @@
             cout << "\t-s x1 x2 x3\tScale all atom coordinates by this vector (x1,x2,x3)." << endl;
             cout << "\t-v/-V\t\tGives version information." << endl;
-            return 0;
+            cout << "Note: config files must not begin with '-' !" << endl;
             break;
           case 'v':
           case 'V':
+            flag=2;
             cout << argv[0] << " " << VERSIONSTRING << endl;
             cout << "Build your own molecule position set." << endl;
-            return 0;
             break;
           case 'e':
@@ -827,15 +828,16 @@
         }
       } else {
+        test.close();
         ConfigFileName = argv[argc-1];
         cout << Verbose(1) << "Specified config file found, parsing ...";
-        switch (configuration.TestSyntax(&test, periode, mol)) {
+        switch (configuration.TestSyntax(ConfigFileName, periode, mol)) {
           case 1:
             cout << "new syntax." << endl;
-            configuration.Load(&test, periode, mol);
+            configuration.Load(ConfigFileName, periode, mol);
             config_present = present;
             break;
           case 0:
             cout << "old syntax." << endl;
-            configuration.LoadOld(&test, periode, mol);
+            configuration.LoadOld(ConfigFileName, periode, mol);
             config_present = present;
             break;
@@ -844,5 +846,4 @@
             config_present = empty;
        }
-        test.close();
       }
     } else
@@ -856,4 +857,5 @@
           switch(argv[argptr-1][1]) {
             case 'p':
+              flag = 1;
               cout << Verbose(1) << "Parsing xyz file for new atoms." << endl;
               if (!mol->AddXYZFile(argv[argptr++]))
@@ -871,4 +873,5 @@
             switch(argv[argptr-1][1]) {
               case 't':
+                flag = 1;
                 cout << Verbose(1) << "Translating all ions to new origin." << endl;
                 for (int i=0;i<3;i++)
@@ -878,4 +881,5 @@
                 break;
               case 'a':
+                flag = 1;
                 cout << Verbose(1) << "Adding new atom." << endl;
                 first = new atom;
@@ -894,4 +898,5 @@
                 break;
               case 's':
+                flag = 1;
                 j = -1;
                 cout << Verbose(1) << "Scaling all ion positions by factor." << endl;
@@ -914,4 +919,5 @@
                 break;
               case 'c':
+                flag = 1;
                 j = -1;
                 cout << Verbose(1) << "Centering atoms in config file within given additional boundary." << endl;
@@ -930,9 +936,10 @@
                 break;
               case 'r':
+                flag = 1;
                 cout << Verbose(1) << "Converting config file from supposed old to new syntax." << endl;
                 break;
               case 'f':
                 int i,j;
-                flag = 0;
+                flag = 1;
                 if (argc > argptr+3) {
                   cout << Verbose(0) << "Creating connection matrix..." << endl;
@@ -998,9 +1005,11 @@
   	  } else argptr++;
   	} while (argptr < (argc-1));
-    if (flag)
+    if (flag == 1)  // 1 means save and exit
       SaveConfig(ConfigFileName, &configuration, periode, mol);
-    delete(mol);
-    delete(periode);
-    return (0);
+    if (flag > 1) { // 2 means just exit
+      delete(mol);
+      delete(periode);
+      return (0);
+    }
   }
 
Index: src/config.cpp
===================================================================
--- src/config.cpp	(revision 5550635707d249fbddac61f337f123ec13876725)
+++ src/config.cpp	(revision 5b15abd736e431efbf95ee359dc600e887d01a25)
@@ -16,7 +16,8 @@
   defaultpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
   pseudopotpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
+  configpath = (char *) MallocString(sizeof(char)*255,"config constructor: mainname");
   strcpy(mainname,"pcp");
-  strcpy(defaultpath,"not specified                                                                                                                                                                                                                                               ");
-  strcpy(pseudopotpath,"not specified                                                                                                                                                                                                                                               ");
+  strcpy(defaultpath,"not specified");
+  strcpy(pseudopotpath,"not specified");
   
   ProcPEGamma=8;
@@ -86,4 +87,5 @@
   Free((void **)&defaultpath, "config::~config: *defaultpath");
   Free((void **)&pseudopotpath, "config::~config: *pseudopotpath");
+  Free((void **)&configpath, "config::~config: *configpath");
 };
 
@@ -352,18 +354,25 @@
 
 /** Tests whether a given configuration file adhears to old or new syntax.
- * \param *file input file stream being the opened config file
+ * \param *filename filename of config file to be tested
  * \param *periode pointer to a periodentafel class with all elements
  * \param *mol pointer to molecule containing all atoms of the molecule
  * \return 0 - old syntax, 1 - new syntax, -1 - unknown syntax 
  */
-int config::TestSyntax(ifstream *file, periodentafel *periode, molecule *mol)
+int config::TestSyntax(char *filename, periodentafel *periode, molecule *mol)
 {
   int test;
+  ifstream file(filename);
+  
   // search file for keyword: ProcPEGamma (new syntax)
-  if (ParseForParameter(1,file,"ProcPEGamma", 0, 1, 1, int_type, &test, 1, optional))
+  if (ParseForParameter(1,&file,"ProcPEGamma", 0, 1, 1, int_type, &test, 1, optional)) {
+    file.close();
     return 1;
+  }
   // search file for keyword: ProcsGammaPsi (old syntax)
-  if (ParseForParameter(1,file,"ProcsGammaPsi", 0, 1, 1, int_type, &test, 1, optional))
+  if (ParseForParameter(1,&file,"ProcsGammaPsi", 0, 1, 1, int_type, &test, 1, optional)) {
+    file.close();
     return 0;
+  }
+  file.close();
   return -1;
 }
@@ -394,4 +403,27 @@
 };
 
+/** Retrieves the path in the given config file name.
+ * \param *filename config file string
+ */
+void config::RetrieveConfigPath(char *filename)
+{
+  int last = -1;
+  for(int i=0;i<255;i++) {
+    if (filename[i] == '/')
+      last = i;
+    if (filename[i] == '\0')
+      break;
+  }
+  if (last == -1) { // no path in front, set to local directory.
+    strcpy(configpath, "./");
+  } else {
+    strncpy(configpath, filename, last+1);
+    if (last < 254)
+      configpath[last+1]='\0';
+  }
+  cout << "Found configpath: " << configpath << ", dir slash was found at " << last << "." << endl;
+};
+
+
 /** Initializes config file structure by loading elements from a give file.
  * \param *file input file stream being the opened config file
@@ -399,6 +431,12 @@
  * \param *mol pointer to molecule containing all atoms of the molecule 
  */
-void config::Load(ifstream *file, periodentafel *periode, molecule *mol)
+void config::Load(char *filename, periodentafel *periode, molecule *mol)
 {
+  ifstream *file = new ifstream(filename);
+  if (file == NULL) {
+    cerr << "ERROR: config file " << filename << " missing!" << endl;
+    return;
+  }
+  RetrieveConfigPath(filename);
   // ParseParameters
   
@@ -615,4 +653,6 @@
     }
   }
+  file->close();
+  delete(file);
 };
 
@@ -622,6 +662,12 @@
  * \param *mol pointer to molecule containing all atoms of the molecule 
  */
-void config::LoadOld(ifstream *file, periodentafel *periode, molecule *mol)
+void config::LoadOld(char *filename, periodentafel *periode, molecule *mol)
 {
+  ifstream *file = new ifstream(filename);
+  if (file == NULL) {
+    cerr << "ERROR: config file " << filename << " missing!" << endl;
+    return;
+  }
+  RetrieveConfigPath(filename);
   // ParseParameters
   
@@ -810,4 +856,6 @@
     }
   }   
+  file->close();
+  delete(file);
 };
 
Index: src/molecules.hpp
===================================================================
--- src/molecules.hpp	(revision 5550635707d249fbddac61f337f123ec13876725)
+++ src/molecules.hpp	(revision 5b15abd736e431efbf95ee359dc600e887d01a25)
@@ -612,4 +612,5 @@
     int ProcPEGamma;
     int ProcPEPsi;
+    char *configpath;
     
     private:
@@ -674,7 +675,8 @@
   ~config();
 
-  int TestSyntax(ifstream *file, periodentafel *periode, molecule *mol);
-  void Load(ifstream *file, periodentafel *periode, molecule *mol);
-  void LoadOld(ifstream *file, periodentafel *periode, molecule *mol);
+  int TestSyntax(char *filename, periodentafel *periode, molecule *mol);
+  void Load(char *filename, periodentafel *periode, molecule *mol);
+  void LoadOld(char *filename, periodentafel *periode, molecule *mol);
+  void RetrieveConfigPath(char *filename);
   bool Save(ofstream *file, periodentafel *periode, molecule *mol) const;
   void Edit(molecule *mol);
