I have several threads and I want each of them to process part of my file. Can I have one ifstream object for this and get them to read different parts at the same time? Parts do not overlap, so the same line will not be processed by two threads. If so, how do you get multiple cursors?
The only one std::ifstreamassociated with exactly one cursor (there is a method seekgand tellgassociated with std::ifstreamdirectly).
std::ifstream
seekg
tellg
, std::ifstream , - , ( , , ).
, std::ifstream . , . , "" (: ).
++ (., , ).
, "". , concurrency .
ifstream (.. ) concurrency . - , , - .
ifstream
, .. . , (. ).
Looking at the FILE struct , it seems that there is a pointer inside the FILE, char* curppointing to the current active pointer, which may mean that for each FILE object you will have one specific part of the file.This is in C, I don’t know how ifstream works, and if it uses a FILE object / it is built as a FILE object. It may not help you at all, but I thought it would be interesting to share this little information and that it might help someone.
char* curp
Source: https://habr.com/ru/post/1676456/More articles:JSON Где предложение по массиву значений с Query Builder - postgresqlИзмените код JavaScript для страницы, если пользователь изменит ее размер - javascriptAxioms of functional programming - functionThe problem of deserialization (recursion object) using Jackson JSON - javahttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1676455/setorder-danish-letters-or-custom-ordering-of-letters-in-a-data-table&usg=ALkJrhgGpu3qzXFwbk0WcBB-O5T8Xv_E4QAccess to the eBay Kleinanzeigen API API (eBay Classifieds of Germany) - apiHow to set background image inside text - androidIs thread stream safe? - c ++How to change activity by receiving status code 401 in Interceptor Android - androidTextured android text - androidAll Articles