diff --git a/samples/DOMCount/DOMCount.cpp b/samples/DOMCount/DOMCount.cpp
index 8f9239ff2781c33a1a774844da42ce12e5bd937c..0cfd244b016d12e4d6f076dd448f090137a98c1c 100644
--- a/samples/DOMCount/DOMCount.cpp
+++ b/samples/DOMCount/DOMCount.cpp
@@ -78,8 +78,6 @@
 #include <fstream.h>
 
 
-
-
 // ---------------------------------------------------------------------------
 //  This is a simple program which invokes the DOMParser to build a DOM
 //  tree for the specified input file. It then walks the tree and counts
@@ -123,7 +121,6 @@ static int countChildElements(DOMNode *n)
     return count;
 }
 
-
 // ---------------------------------------------------------------------------
 //
 //   main
@@ -278,13 +275,18 @@ int main(int argC, char* argV[])
 
     // the input is a list file
     if (doList)
-        fin.open(argV[argInd]);
+        fin.open(argV[argInd],ios::nocreate);
+
+    if (fin.fail()) {
+        cerr <<"Cannot open the list file: " << argV[argInd] << endl;
+        return 2;
+    }
 
     while (more)
     {
         char fURI[1000];
         //initialize the array to zeros
-        memset(fURI,0,strlen(fURI));
+        memset(fURI,0,sizeof(fURI));
 
         if (doList) {
             if (! fin.eof() ) {
diff --git a/samples/SAX2Count/SAX2Count.cpp b/samples/SAX2Count/SAX2Count.cpp
index 80f9ddde580f0b3c37d18b3de0976f635bf36f48..c82cbac896743e6abff608788aeb14066604efa7 100644
--- a/samples/SAX2Count/SAX2Count.cpp
+++ b/samples/SAX2Count/SAX2Count.cpp
@@ -56,6 +56,9 @@
 
 /*
 * $Log$
+* Revision 1.20  2002/11/01 22:05:57  tng
+* Samples/Test update: Issue error if the list file failed to open.
+*
 * Revision 1.19  2002/09/27 19:24:57  tng
 * Samples Fix: wrong length in memset
 *
@@ -315,13 +318,18 @@ int main(int argC, char* argV[])
 
     // the input is a list file
     if (doList)
-        fin.open(argV[argInd]);
+        fin.open(argV[argInd],ios::nocreate);
+
+    if (fin.fail()) {
+        cerr <<"Cannot open the list file: " << argV[argInd] << endl;
+        return 2;
+    }
 
     while (more)
     {
         char fURI[1000];
         //initialize the array to zeros
-        memset(fURI,0,strlen(fURI));
+        memset(fURI,0,sizeof(fURI));
 
         if (doList) {
             if (! fin.eof() ) {
diff --git a/samples/SAXCount/SAXCount.cpp b/samples/SAXCount/SAXCount.cpp
index 58902728a23ac53685c3d62017e7f637625a91e0..00f44c8b5957a99d666cc031477049e343d506d1 100644
--- a/samples/SAXCount/SAXCount.cpp
+++ b/samples/SAXCount/SAXCount.cpp
@@ -56,6 +56,9 @@
 
 /*
 * $Log$
+* Revision 1.23  2002/11/01 22:05:44  tng
+* Samples/Test update: Issue error if the list file failed to open.
+*
 * Revision 1.22  2002/09/27 19:25:10  tng
 * Samples Fix: wrong length in memset
 *
@@ -310,13 +313,18 @@ int main(int argC, char* argV[])
 
     // the input is a list file
     if (doList)
-        fin.open(argV[argInd]);
+        fin.open(argV[argInd],ios::nocreate);
+
+    if (fin.fail()) {
+        cerr <<"Cannot open the list file: " << argV[argInd] << endl;
+        return 2;
+    }
 
     while (true)
     {
         char fURI[1000];
         //initialize the array to zeros
-        memset(fURI,0,strlen(fURI));
+        memset(fURI,0,sizeof(fURI));
 
         if (doList) {
             if (! fin.eof() ) {
diff --git a/tests/DOM/DeprecatedDOMCount/DeprecatedDOMCount.cpp b/tests/DOM/DeprecatedDOMCount/DeprecatedDOMCount.cpp
index 71c573ba6a9499fd02235ce48f87a153ac2777fb..e8f204cc03ed68679fad1753e5eafb0855928bd2 100644
--- a/tests/DOM/DeprecatedDOMCount/DeprecatedDOMCount.cpp
+++ b/tests/DOM/DeprecatedDOMCount/DeprecatedDOMCount.cpp
@@ -226,13 +226,18 @@ int main(int argC, char* argV[])
 
     // the input is a list file
     if (doList)
-        fin.open(argV[argInd]);
+        fin.open(argV[argInd],ios::nocreate);
+
+    if (fin.fail()) {
+        cerr <<"Cannot open the list file: " << argV[argInd] << endl;
+        return 2;
+    }
 
     while (more)
     {
         char fURI[1000];
         //initialize the array to zeros
-        memset(fURI,0,strlen(fURI));
+        memset(fURI,0,sizeof(fURI));
 
         if (doList) {
             if (! fin.eof() ) {