Porting from a NT to a '98
-
I made a lil' app on a NT4.0 system. It works fine. But when I run my prog on a windows '98 it just didn't work. When I recompiled the prog on the '98 it worked fine. When I run it I get a c++ exception. Now, I don't think that's the big problem. The problem is that in a method like this: void HTML::HTML_FileHeader(char* filename,char* pagehead,char* tableheader) { fileout.open(filename,ios::trunc); CString mesaj; char text[100]; fileout<< "\n" "\n" "\n" "\n" "
"; fileout<< pagehead; mesaj.Format(" %d, data de %d",time.GetHour(),time.GetDay()); strcpy(text,(LPCTSTR)mesaj); fileout<< text; fileout<< "
\n" "\n" "\n"; fileout<< tableheader<<"\n"; } doesn't work. fileout.open(filename,ios::trunc); doesn't work. He doesn't like the (char *)filename. If i replace filename with the actual file that it has to open it works fine. This happens in every method of the class. He doesn't like getting that. If I debug it the content of filename is correct. This is very odd (to me). When I create a new win32 console app and I open a file that way in the main function it works fine. !!!! I also open databases from methods opendatabase(databasename). This also doesn't work until I replace the databasename with the actual db name "databasename". What am I doing wrong ?????? Somebody knows anything about this problem ? P.S. I get the c++ exception because I'm trying to open a db and since he doesn't like the arguments like that (see below) it doesn't work DBDatabase = DBEngine.OpenDatabase ( text ); DBRecordset = Database.OpenRecordset((LPCTSTR)openstring,dbOpenDynaset,dbDenyWrite);
ORAS
-
I made a lil' app on a NT4.0 system. It works fine. But when I run my prog on a windows '98 it just didn't work. When I recompiled the prog on the '98 it worked fine. When I run it I get a c++ exception. Now, I don't think that's the big problem. The problem is that in a method like this: void HTML::HTML_FileHeader(char* filename,char* pagehead,char* tableheader) { fileout.open(filename,ios::trunc); CString mesaj; char text[100]; fileout<< "\n" "\n" "\n" "\n" "
"; fileout<< pagehead; mesaj.Format(" %d, data de %d",time.GetHour(),time.GetDay()); strcpy(text,(LPCTSTR)mesaj); fileout<< text; fileout<< "
\n" "\n" "\n"; fileout<< tableheader<<"\n"; } doesn't work. fileout.open(filename,ios::trunc); doesn't work. He doesn't like the (char *)filename. If i replace filename with the actual file that it has to open it works fine. This happens in every method of the class. He doesn't like getting that. If I debug it the content of filename is correct. This is very odd (to me). When I create a new win32 console app and I open a file that way in the main function it works fine. !!!! I also open databases from methods opendatabase(databasename). This also doesn't work until I replace the databasename with the actual db name "databasename". What am I doing wrong ?????? Somebody knows anything about this problem ? P.S. I get the c++ exception because I'm trying to open a db and since he doesn't like the arguments like that (see below) it doesn't work DBDatabase = DBEngine.OpenDatabase ( text ); DBRecordset = Database.OpenRecordset((LPCTSTR)openstring,dbOpenDynaset,dbDenyWrite);
ORAS
This is a problem of the filename. You should use the complete path. Maybe you should check that the file exist before you open it. (If not a messagbeox, for the alpha-release) Remember: exception handling is best practice, get the exception message in a box. If recompiling helps it maybe also that different version are installed on different machines. (header, code, libs, dll) You godda puzzle some bits.:cool: Try this @ home. (B&B)
-
This is a problem of the filename. You should use the complete path. Maybe you should check that the file exist before you open it. (If not a messagbeox, for the alpha-release) Remember: exception handling is best practice, get the exception message in a box. If recompiling helps it maybe also that different version are installed on different machines. (header, code, libs, dll) You godda puzzle some bits.:cool: Try this @ home. (B&B)
I can't use the complete path. This is not a solution because I have more than one file to be opened. And I checked for the existance of the filename. And it doesn't work neither when I try to open a database the same way I do the file. And EXCEPTION HANDLING -- I got the following answer:win32 exception. That helps alot :(
-
I can't use the complete path. This is not a solution because I have more than one file to be opened. And I checked for the existance of the filename. And it doesn't work neither when I try to open a database the same way I do the file. And EXCEPTION HANDLING -- I got the following answer:win32 exception. That helps alot :(
I had THIS problem also, it resolved that file couldn´t be found in the release-mode, because of the working directory and relative path. Not working with the complete path isn´t good style and you have your results. And more than one file open can also be an architectual problem. Try to handle one file or db after the other. Or merge the file / dbs. You get an exception, because the programmer of the code you want to use had implemented it!!! Look for it!!! Try this @ home. (B&B)
-
I can't use the complete path. This is not a solution because I have more than one file to be opened. And I checked for the existance of the filename. And it doesn't work neither when I try to open a database the same way I do the file. And EXCEPTION HANDLING -- I got the following answer:win32 exception. That helps alot :(
BlackRider wrote: the following answer:win32 except Try to show the value of GetLastError() My latest article: SQL Server DO's and DONT's[^]