[LLVMbugs] [Bug 16783] New: fstream::readsome can not read any data

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Aug 3 04:05:15 PDT 2013


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: hhinnant at apple.com
          Reporter: xtaotao at qq.com
                CC: llvmbugs at cs.uiuc.edu
    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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130803/e42a0c4b/attachment.html>


More information about the llvm-bugs mailing list