cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Copy x characters from a file to a c++ s
Copy x characters from a file to a c++ string?
Nov 3, 2012 at 5:08pm UTC
rozick1
(218)
I want to copy 15 characters at a time from a file into a c++ string until the eof is reached (if the last read is less than 15 then I want those too). None of the methods in ifstream looked appropriate ( I don't want any delimiter).
What's the best way of doing this?
Thanks!
Nov 3, 2012 at 5:17pm UTC
Moschops
(7244)
You can use fread to read exactly 15 bytes.
http://www.cplusplus.com/reference/clibrary/cstdio/fread/
Topic archived. No new replies allowed.