Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Porting from a NT to a '98

Porting from a NT to a '98

Scheduled Pinned Locked Moved C / C++ / MFC
databasec++htmliosdebugging
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BlackRider
    wrote on last edited by
    #1

    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

    K 1 Reply Last reply
    0
    • B BlackRider

      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

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      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)

      B 1 Reply Last reply
      0
      • K KarstenK

        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)

        B Offline
        B Offline
        BlackRider
        wrote on last edited by
        #3

        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 :(

        K D 2 Replies Last reply
        0
        • B BlackRider

          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 :(

          K Offline
          K Offline
          KarstenK
          wrote on last edited by
          #4

          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)

          1 Reply Last reply
          0
          • B BlackRider

            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 :(

            D Offline
            D Offline
            Daniel Turini
            wrote on last edited by
            #5

            BlackRider wrote: the following answer:win32 except Try to show the value of GetLastError() My latest article: SQL Server DO's and DONT's[^]

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups