Thread: How does the file read and write at the same time, together these combining?

  1. #1
    Registered User
    Join Date
    Nov 2015
    Posts
    119

    How does the file read and write at the same time, together these combining?

    All good reading! Respect for forum users. I would like to open the file for reading and writing simultaneously, but catching errors.
    Also, in addition, I would like to sample a sample, or a short hint, how to read binary file one byte at a time?


    Code:
    std::iostream lzw_file("test.lzw",  std::ios::binary|std::ios::in|std::ios::out );
    no matching function for call to 'std::basic_iostream<char>::basic_iostream(const char [9], std::_Ios_Openmode)'|
    Last edited by Dmy; 07-03-2017 at 06:46 AM.

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,633
    Okay, what don't you understand about that error message?

    Did you try researching how to use the "iostream" class? If you would have you probably would have discovered that "iostream" is the name of a C++ standard header file not a C++ class.

    Perhaps you should review your textbook on how to read and write to file streams, or perhaps study this link.

    Jim

  3. #3
    Guest
    Guest
    Quote Originally Posted by Dmy
    Respect for forum users.
    Cheeki breeki comrade! The class for reading/writing files is std::fstream, not std::iostream.

    @Jim: the link you posted doesn't get encoded properly. Either a typo, or the recent forum update broke the redirect feature.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 12
    Last Post: 06-18-2012, 08:23 AM
  2. Write and Read File at the same time
    By hqt in forum C++ Programming
    Replies: 2
    Last Post: 01-07-2012, 05:53 AM
  3. r+ in fopen doesnt let me read and write at the same time
    By shiroaisu in forum C Programming
    Replies: 8
    Last Post: 09-04-2011, 08:33 PM
  4. Read/Write file at the same time
    By doia in forum C Programming
    Replies: 2
    Last Post: 02-25-2010, 04:18 PM

Tags for this Thread