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. troubles in making a filecopy program in visual c++

troubles in making a filecopy program in visual c++

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
25 Posts 10 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.
  • F firebolt77

    hi all..I'm newbie in visual c++ and I'm trying to make a simple file copy program, but it doesn't work. Here is my source code: #include #include int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone); try { m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } m_DataFile.Read(a,m_DataFile.GetLength); m_LogFile.Write(a,strlen(a)); return 0; } The message error said that the m_DataFile.Read(a,m_DataFile.GetLength); part is wrong, but when I change the 2nd parameter into fixed number(I tried 10 and 100), it generate other error. Can somebody help me? thx

    K Offline
    K Offline
    khan
    wrote on last edited by
    #3

    1- Change m_DataFile.Read(a,m_DataFile.GetLength); to: m_DataFile.Read(a,m_DataFile.GetLength()); because GetLength() is a function. 2- And also, you are using char* a = NULL; You are not assigning any memory to it. It is a null pointer. You can try this: char* a = NULL; a = m_DataFile.GetLength() + 1; memset(a,0,m_DataFile.GetLength()+1); Then read the file into it: m_DataFile.Read(a,m_DataFile.GetLength()); this is this.

    F 1 Reply Last reply
    0
    • K khan

      1- Change m_DataFile.Read(a,m_DataFile.GetLength); to: m_DataFile.Read(a,m_DataFile.GetLength()); because GetLength() is a function. 2- And also, you are using char* a = NULL; You are not assigning any memory to it. It is a null pointer. You can try this: char* a = NULL; a = m_DataFile.GetLength() + 1; memset(a,0,m_DataFile.GetLength()+1); Then read the file into it: m_DataFile.Read(a,m_DataFile.GetLength()); this is this.

      F Offline
      F Offline
      firebolt77
      wrote on last edited by
      #4

      I already change the source code..but it is still error. This is my source code: #include #include #include int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone); try { m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } memset(a,0,m_DataFile.GetLength()+1); m_DataFile.Read(a,m_DataFile.GetLength()); m_LogFile.Write(a,strlen(a)); return 0; } n the program generate these errors: nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex Debug/excel.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. excel.exe - 3 error(s), 0 warning(s) n I don't understand what it's means...pls help. thx

      M D 2 Replies Last reply
      0
      • C Christian Graus

        I can't find it, but there is most certainly an API call you can make to copy a file, if you want to. In the meantime, m_DataFile.GetLength is a function pointer. m_DataFile.GetLength() is a function call. Christian Graus - Microsoft MVP - C++

        A Offline
        A Offline
        Aamir Butt
        wrote on last edited by
        #5

        It is CopyFile(...) :) Einstein: "Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." My Articles

        C 1 Reply Last reply
        0
        • F firebolt77

          I already change the source code..but it is still error. This is my source code: #include #include #include int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone); try { m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } memset(a,0,m_DataFile.GetLength()+1); m_DataFile.Read(a,m_DataFile.GetLength()); m_LogFile.Write(a,strlen(a)); return 0; } n the program generate these errors: nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex Debug/excel.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. excel.exe - 3 error(s), 0 warning(s) n I don't understand what it's means...pls help. thx

          M Offline
          M Offline
          munawar1968
          wrote on last edited by
          #6

          If you're using VC 6. do the following: Menu item Project->Settings->Tab C++ -> Category 'Code Generation'-> set this option to 'Multithreaded' or 'Debug Multithreaded'

          F 1 Reply Last reply
          0
          • F firebolt77

            hi all..I'm newbie in visual c++ and I'm trying to make a simple file copy program, but it doesn't work. Here is my source code: #include #include int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone); try { m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } m_DataFile.Read(a,m_DataFile.GetLength); m_LogFile.Write(a,strlen(a)); return 0; } The message error said that the m_DataFile.Read(a,m_DataFile.GetLength); part is wrong, but when I change the 2nd parameter into fixed number(I tried 10 and 100), it generate other error. Can somebody help me? thx

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #7

            A simple trick - when you want to see if a function exists to do something go Help->Index and try typing in possible function names. As you type more letters it narrows the results. "Filecopy" didn't return anything but "Copyfile" returned CopyFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists) Elaine :rose: The tigress is here :-D

            F K 2 Replies Last reply
            0
            • M munawar1968

              If you're using VC 6. do the following: Menu item Project->Settings->Tab C++ -> Category 'Code Generation'-> set this option to 'Multithreaded' or 'Debug Multithreaded'

              F Offline
              F Offline
              firebolt77
              wrote on last edited by
              #8

              I already change the code generation into multithreaded. The program can be compiled successfully but when I run it, it generate an error and can't run. Give me some hints please. Is there any logic error on my program? The reason that I didn't use CopyFile is if the program works, I'm planning to make a program that can make XML file from text file which I think it can't be done using CopyFile function. thx.

              D 1 Reply Last reply
              0
              • L Lost User

                A simple trick - when you want to see if a function exists to do something go Help->Index and try typing in possible function names. As you type more letters it narrows the results. "Filecopy" didn't return anything but "Copyfile" returned CopyFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists) Elaine :rose: The tigress is here :-D

                F Offline
                F Offline
                firebolt77
                wrote on last edited by
                #9

                I already change the code generation into multithreaded. The program can be compiled successfully but when I run it, it generate an error and can't run. Give me some hints please. Is there any logic error on my program? The reason that I didn't use CopyFile is if the program works, I'm planning to make a program that can make XML file from text file which I think it can't be done using CopyFile function. thx.

                1 Reply Last reply
                0
                • L Lost User

                  A simple trick - when you want to see if a function exists to do something go Help->Index and try typing in possible function names. As you type more letters it narrows the results. "Filecopy" didn't return anything but "Copyfile" returned CopyFile(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists) Elaine :rose: The tigress is here :-D

                  K Offline
                  K Offline
                  khan
                  wrote on last edited by
                  #10

                  I am soooo sorry that I mis-wrote a line in my earlier post: a = m_DataFile.GetLength() + 1;//error. Do not use. Should have been: a = new char [m_DataFile.GetLength() + 1]; //This one will do the thing. :) this is this.

                  1 Reply Last reply
                  0
                  • F firebolt77

                    hi all..I'm newbie in visual c++ and I'm trying to make a simple file copy program, but it doesn't work. Here is my source code: #include #include int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone); try { m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } m_DataFile.Read(a,m_DataFile.GetLength); m_LogFile.Write(a,strlen(a)); return 0; } The message error said that the m_DataFile.Read(a,m_DataFile.GetLength); part is wrong, but when I change the 2nd parameter into fixed number(I tried 10 and 100), it generate other error. Can somebody help me? thx

                    S Offline
                    S Offline
                    Stlan
                    wrote on last edited by
                    #11

                    Are you sure the files pathes are correct? It seems that "E:/data.txt" is very likely not a valid file name. You should use "E:\\data.txt" instead.

                    F 1 Reply Last reply
                    0
                    • F firebolt77

                      I already change the code generation into multithreaded. The program can be compiled successfully but when I run it, it generate an error and can't run. Give me some hints please. Is there any logic error on my program? The reason that I didn't use CopyFile is if the program works, I'm planning to make a program that can make XML file from text file which I think it can't be done using CopyFile function. thx.

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #12

                      firebolt77 wrote: ...when I run it, it generate an error and can't run. And what would that error be?


                      "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                      1 Reply Last reply
                      0
                      • F firebolt77

                        I already change the source code..but it is still error. This is my source code: #include #include #include int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone); try { m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } memset(a,0,m_DataFile.GetLength()+1); m_DataFile.Read(a,m_DataFile.GetLength()); m_LogFile.Write(a,strlen(a)); return 0; } n the program generate these errors: nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex Debug/excel.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. excel.exe - 3 error(s), 0 warning(s) n I don't understand what it's means...pls help. thx

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #13

                        firebolt77 wrote: n the program generate these errors: nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex Debug/excel.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. Remove the /MT linker option.


                        "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                        B 1 Reply Last reply
                        0
                        • F firebolt77

                          hi all..I'm newbie in visual c++ and I'm trying to make a simple file copy program, but it doesn't work. Here is my source code: #include #include int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone); try { m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } m_DataFile.Read(a,m_DataFile.GetLength); m_LogFile.Write(a,strlen(a)); return 0; } The message error said that the m_DataFile.Read(a,m_DataFile.GetLength); part is wrong, but when I change the 2nd parameter into fixed number(I tried 10 and 100), it generate other error. Can somebody help me? thx

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #14

                          firebolt77 wrote: m_DataFile.Read(a,m_DataFile.GetLength); At this point, a is a NULL pointer. A crash is imminent. firebolt77 wrote: m_LogFile.Write(a,strlen(a)); This erroneously assumes that a will have a \0 character and that it will be at the end.


                          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                          1 Reply Last reply
                          0
                          • S Stlan

                            Are you sure the files pathes are correct? It seems that "E:/data.txt" is very likely not a valid file name. You should use "E:\\data.txt" instead.

                            F Offline
                            F Offline
                            firebolt77
                            wrote on last edited by
                            #15

                            I already tried all the instructions, but still the program can't run. Although it doesn't generate error on compile process, but when I try to run it, it won't run. Here is my modified source code: int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:\\data.txt", CFile::modeRead|CFile::shareDenyNone); a = new char [m_DataFile.GetLength() + 1]; memset(a,0,m_DataFile.GetLength() + 1); try { m_LogFile.Open("E:\\data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } m_DataFile.Read(a,m_DataFile.GetLength()); m_LogFile.Write(a,strlen(a)); m_DataFile.Close(); m_LogFile.Close(); return 0; }

                            S D 2 Replies Last reply
                            0
                            • F firebolt77

                              I already tried all the instructions, but still the program can't run. Although it doesn't generate error on compile process, but when I try to run it, it won't run. Here is my modified source code: int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:\\data.txt", CFile::modeRead|CFile::shareDenyNone); a = new char [m_DataFile.GetLength() + 1]; memset(a,0,m_DataFile.GetLength() + 1); try { m_LogFile.Open("E:\\data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } m_DataFile.Read(a,m_DataFile.GetLength()); m_LogFile.Write(a,strlen(a)); m_DataFile.Close(); m_LogFile.Close(); return 0; }

                              S Offline
                              S Offline
                              Stlan
                              wrote on last edited by
                              #16

                              Execute step by step your program in debug mode, and check for the result value returned by the Open, Read, Write, etc. functions. You should then be able to locate where exactly is the problem.

                              1 Reply Last reply
                              0
                              • D David Crow

                                firebolt77 wrote: n the program generate these errors: nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex Debug/excel.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe. Remove the /MT linker option.


                                "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                                B Offline
                                B Offline
                                Bob Stanneveld
                                wrote on last edited by
                                #17

                                No, he is using MFC, but he made a console application. So the default settings cause the linker not to link with the MFC libraries. He should change that setting to link dynamically or statically to the MFC. Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

                                D 1 Reply Last reply
                                0
                                • B Bob Stanneveld

                                  No, he is using MFC, but he made a console application. So the default settings cause the linker not to link with the MFC libraries. He should change that setting to link dynamically or statically to the MFC. Behind every great black man...             ... is the police. - Conspiracy brother Blog[^]

                                  D Offline
                                  D Offline
                                  David Crow
                                  wrote on last edited by
                                  #18

                                  If that was the case, the linker would be complaining about MFC-related code instead of __endthreadex and __beginthreadex. See here for more.


                                  "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                                  B 1 Reply Last reply
                                  0
                                  • F firebolt77

                                    I already tried all the instructions, but still the program can't run. Although it doesn't generate error on compile process, but when I try to run it, it won't run. Here is my modified source code: int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:\\data.txt", CFile::modeRead|CFile::shareDenyNone); a = new char [m_DataFile.GetLength() + 1]; memset(a,0,m_DataFile.GetLength() + 1); try { m_LogFile.Open("E:\\data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } m_DataFile.Read(a,m_DataFile.GetLength()); m_LogFile.Write(a,strlen(a)); m_DataFile.Close(); m_LogFile.Close(); return 0; }

                                    D Offline
                                    D Offline
                                    David Crow
                                    wrote on last edited by
                                    #19

                                    firebolt77 wrote: ...but when I try to run it... Which means what? Single-stepping through each statement, which one is not working?


                                    "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

                                    1 Reply Last reply
                                    0
                                    • F firebolt77

                                      hi all..I'm newbie in visual c++ and I'm trying to make a simple file copy program, but it doesn't work. Here is my source code: #include #include int main() { CFile m_LogFile,m_DataFile; char* a=NULL; m_DataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyNone); try { m_LogFile.Open("E:/data1.txt", CFile::modeWrite|CFile::modeRead|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyNone); m_LogFile.SeekToEnd(); } catch(CException* e) { e->ReportError(); e->Delete(); } m_DataFile.Read(a,m_DataFile.GetLength); m_LogFile.Write(a,strlen(a)); return 0; } The message error said that the m_DataFile.Read(a,m_DataFile.GetLength); part is wrong, but when I change the 2nd parameter into fixed number(I tried 10 and 100), it generate other error. Can somebody help me? thx

                                      J Offline
                                      J Offline
                                      Joe Woodbury
                                      wrote on last edited by
                                      #20

                                      This code is not tested, I don't have the time, but here's a quick pass with comments. #include #include int main() { // Initialize MFC if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { _tprintf(_T("Fatal Error: MFC initialization failed\n")); return 1; } // m_ is a C++ convention to indicate a variabe is a data member // of a class. Also by convention, the first letter after the // underscore is lower case. For example, it would be m_logFile. // These are local variables, thus the m_ has been removed. CFile logFile, dataFile; // the char *a has been moved below, closer to where it is actually // being used. // The share mode should probably be deny write to prevent someone // from using while attempting other operations. dataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyWrite); // the try block is not needed since CFile::Open does not throw // an exception. (The CFile constructor throws an exception.) // Instead, we pass CFileException as a parameter and check the BOOL // return. // I also added ShareDenyWrite to prevent any other program from writing // to the file at the same time. CFileException err; if (!logFile.Open("E:/data1.txt", CFile::modeReadWrite|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyWrite, &err)) { // If I remember, this pops up a message box. For console apps // it's generally better to use _tprintf() or _tputs() err.ReportError(); return 1; } logFile.SeekToEnd(); // since we aren't using smart pointers for pBuffer, // this reduces having to add a delete before an // explicit error return. int rval = 0; // Allocate the buffer here. Note I used the convention of a p for // pointer. This is the extent of my general notation rules. int bufferLen = dataFile.GetLength(); char* pBuffer = new char[bufferLen]; if (dataFile.Read(pBuffer, bufferLen) == dataFile.GetLength()) { if (logFile.Write(pBuffer, bufferLen) != bufferLen) { _tprintf("Error writing file\n"); rval = 1; } } delete [] pBuffer; return rval; } Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

                                      F 1 Reply Last reply
                                      0
                                      • A Aamir Butt

                                        It is CopyFile(...) :) Einstein: "Two things are infinite: the universe and human stupidity; and I'm not sure about the the universe." My Articles

                                        C Offline
                                        C Offline
                                        Christian Graus
                                        wrote on last edited by
                                        #21

                                        Thanks - I thought it was, but I did a google on CopyFile C++ and got no helpful links. Usually, MSDN is the first hit in a case like that. Christian Graus - Microsoft MVP - C++

                                        1 Reply Last reply
                                        0
                                        • J Joe Woodbury

                                          This code is not tested, I don't have the time, but here's a quick pass with comments. #include #include int main() { // Initialize MFC if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { _tprintf(_T("Fatal Error: MFC initialization failed\n")); return 1; } // m_ is a C++ convention to indicate a variabe is a data member // of a class. Also by convention, the first letter after the // underscore is lower case. For example, it would be m_logFile. // These are local variables, thus the m_ has been removed. CFile logFile, dataFile; // the char *a has been moved below, closer to where it is actually // being used. // The share mode should probably be deny write to prevent someone // from using while attempting other operations. dataFile.Open("E:/data.txt", CFile::modeRead|CFile::shareDenyWrite); // the try block is not needed since CFile::Open does not throw // an exception. (The CFile constructor throws an exception.) // Instead, we pass CFileException as a parameter and check the BOOL // return. // I also added ShareDenyWrite to prevent any other program from writing // to the file at the same time. CFileException err; if (!logFile.Open("E:/data1.txt", CFile::modeReadWrite|CFile::modeCreate|CFile::modeNoTruncate|CFile::shareDenyWrite, &err)) { // If I remember, this pops up a message box. For console apps // it's generally better to use _tprintf() or _tputs() err.ReportError(); return 1; } logFile.SeekToEnd(); // since we aren't using smart pointers for pBuffer, // this reduces having to add a delete before an // explicit error return. int rval = 0; // Allocate the buffer here. Note I used the convention of a p for // pointer. This is the extent of my general notation rules. int bufferLen = dataFile.GetLength(); char* pBuffer = new char[bufferLen]; if (dataFile.Read(pBuffer, bufferLen) == dataFile.GetLength()) { if (logFile.Write(pBuffer, bufferLen) != bufferLen) { _tprintf("Error writing file\n"); rval = 1; } } delete [] pBuffer; return rval; } Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke

                                          F Offline
                                          F Offline
                                          firebolt77
                                          wrote on last edited by
                                          #22

                                          I have tried the code(Mr. Joe Woodbury's code), but when I run it, it generate the same error with my code, although there is no error in the compile process.When I run the program, it generate a typical windows error dialog box(the one that has debug,send error report, and don't send button). I also try to debug it, but when I debug it, it opens other source code(winmain.cpp). I'm so confused. Pls help.. thx.

                                          J 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