Problem in binary file reading

Discussion in 'C++' started by ganesh_IT, Aug 28, 2010.

  1. ganesh_IT

    ganesh_IT New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi developers, i try to write a file in binary format. But that file is not in binary format, i dont know what's wrong in my code
    #include
    #include
    using namespace std;

    int main()
    {
    fstream file("file path", ios_base::binary | ios_base::in);
    char buf[] = "BinaryFile";
    file.write(buf, sizeof(buf));
    file.close();
    }
    //My file is not in binary format whats wrong in my code explain me guys...Thanks in Advance
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice