http://llvm.org/bugs/show_bug.cgi?id=16783

            Bug ID: 16783
           Summary: fstream::readsome can not read any data
           Product: libc++
           Version: unspecified
          Hardware: Macintosh
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

I download the libcxx 3.3 source with llvm 3.3 release version source. and
compiler it with libunwind, libcxxrt.

// clang++ a.cpp -std=c++11 -stdlib=libc++
// ubuntu 13.04
// clang version 3.3

#include <fstream>
#include <iostream>

int main(int argc, char* argv[])
{
    std::ifstream fs(argv[0], std::ios::in);
    char szBuffer[1024];
    auto readSize = fs.readsome(szBuffer, 1024);
    std::cout << "read size: " << readSize << ", rdstate: " << fs.rdstate() <<
", good: " << fs.good() << ", eof: " << fs.eof() << "." << std::endl;
    // output: read size: 0, rdstate: 0, good: 1, eof: 0.

    auto beginPos = fs.tellg();
    fs.read(szBuffer, 1024);
    auto newPos = fs.tellg();
    std::cout << "read size: " << newPos - beginPos << ", rdstate: " <<
fs.rdstate() << ", good: " << fs.good() << ", eof: " << fs.eof() << "." <<
std::endl;
    // output: read size: 1024, rdstate: 0, good: 1, eof: 0.

    return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to