{"action":"created","comment":{"url":"https://api.github.com/repos/mapsme/omim/pulls/comments/47224609","id":47224609,"diff_hunk":"@@ -44,7 +44,7 @@ FileData::FileData(string const & fileName, Op op)\n   if (op == OP_WRITE_EXISTING)\n   {\n     // Special case, since \"r+b\" fails if file doesn't exist.\n-    m_File = fopen(fileName.c_str(), \"wb\");\n+    m_File = fopen(fileName.c_str(), \"w+b\");","path":"coding/internal/file_data.cpp","position":5,"original_position":5,"commit_id":"de99778cedd4f1da26c847e6cfb7368fb51dddae","original_commit_id":"de99778cedd4f1da26c847e6cfb7368fb51dddae","user":{"login":"ygorshenin","id":454567,"avatar_url":"https://avatars.githubusercontent.com/u/454567?v=3","gravatar_id":"","url":"https://api.github.com/users/ygorshenin","html_url":"https://github.com/ygorshenin","followers_url":"https://api.github.com/users/ygorshenin/followers","following_url":"https://api.github.com/users/ygorshenin/following{/other_user}","gists_url":"https://api.github.com/users/ygorshenin/gists{/gist_id}","starred_url":"https://api.github.com/users/ygorshenin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ygorshenin/subscriptions","organizations_url":"https://api.github.com/users/ygorshenin/orgs","repos_url":"https://api.github.com/users/ygorshenin/repos","events_url":"https://api.github.com/users/ygorshenin/events{/privacy}","received_events_url":"https://api.github.com/users/ygorshenin/received_events","type":"User","site_admin":false},"body":"w+b truncates file to 0 length or creates for reading and writing. wb truncates to 0 length or creates for writing. What the point in your change?","created_at":"2015-12-10T13:22:34Z","updated_at":"2015-12-10T13:22:34Z","html_url":"https://github.com/mapsme/omim/pull/921#discussion_r47224609","pull_request_url":"https://api.github.com/repos/mapsme/omim/pulls/921","_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments/47224609"},"html":{"href":"https://github.com/mapsme/omim/pull/921#discussion_r47224609"},"pull_request":{"href":"https://api.github.com/repos/mapsme/omim/pulls/921"}}},"pull_request":{"url":"https://api.github.com/repos/mapsme/omim/pulls/921","id":53248190,"html_url":"https://github.com/mapsme/omim/pull/921","diff_url":"https://github.com/mapsme/omim/pull/921.diff","patch_url":"https://github.com/mapsme/omim/pull/921.patch","issue_url":"https://api.github.com/repos/mapsme/omim/issues/921","number":921,"state":"open","locked":false,"title":"Open file with flag w+b if it does not exist","user":{"login":"kshalnev","id":8023141,"avatar_url":"https://avatars.githubusercontent.com/u/8023141?v=3","gravatar_id":"","url":"https://api.github.com/users/kshalnev","html_url":"https://github.com/kshalnev","followers_url":"https://api.github.com/users/kshalnev/followers","following_url":"https://api.github.com/users/kshalnev/following{/other_user}","gists_url":"https://api.github.com/users/kshalnev/gists{/gist_id}","starred_url":"https://api.github.com/users/kshalnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshalnev/subscriptions","organizations_url":"https://api.github.com/users/kshalnev/orgs","repos_url":"https://api.github.com/users/kshalnev/repos","events_url":"https://api.github.com/users/kshalnev/events{/privacy}","received_events_url":"https://api.github.com/users/kshalnev/received_events","type":"User","site_admin":false},"body":"Если передавать в конструктор флаг OP_WRITE_EXISTING, то\r\n- если файл существует, то он откроется с флагом r+b - Open a file for update (both for input and output). The file must exist. То есть файл можно читать и писать.\r\n- если файл не существует, то он открывается с флагом wb - Create an empty file for output operations. If a file with the same name already exists, its contents are discarded and the file is treated as a new empty file. То есть файл можно писать, но не читать.\r\n\r\nЕсли файл не существует, то было бы удобно создать файл с флагом w+b - Create an empty file and open it for update (both for input and output). If a file with the same name already exists its contents are discarded and the file is treated as a new empty file. Тогда файл можно и писать и читать.\r\n\r\n","created_at":"2015-12-10T11:47:47Z","updated_at":"2015-12-10T13:22:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"155917e05f8fb15548e1bd7baf8c4dfcac0b2036","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mapsme/omim/pulls/921/commits","review_comments_url":"https://api.github.com/repos/mapsme/omim/pulls/921/comments","review_comment_url":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapsme/omim/issues/921/comments","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/de99778cedd4f1da26c847e6cfb7368fb51dddae","head":{"label":"kshalnev:data_file_fix","ref":"data_file_fix","sha":"de99778cedd4f1da26c847e6cfb7368fb51dddae","user":{"login":"kshalnev","id":8023141,"avatar_url":"https://avatars.githubusercontent.com/u/8023141?v=3","gravatar_id":"","url":"https://api.github.com/users/kshalnev","html_url":"https://github.com/kshalnev","followers_url":"https://api.github.com/users/kshalnev/followers","following_url":"https://api.github.com/users/kshalnev/following{/other_user}","gists_url":"https://api.github.com/users/kshalnev/gists{/gist_id}","starred_url":"https://api.github.com/users/kshalnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshalnev/subscriptions","organizations_url":"https://api.github.com/users/kshalnev/orgs","repos_url":"https://api.github.com/users/kshalnev/repos","events_url":"https://api.github.com/users/kshalnev/events{/privacy}","received_events_url":"https://api.github.com/users/kshalnev/received_events","type":"User","site_admin":false},"repo":{"id":43427584,"name":"omim","full_name":"kshalnev/omim","owner":{"login":"kshalnev","id":8023141,"avatar_url":"https://avatars.githubusercontent.com/u/8023141?v=3","gravatar_id":"","url":"https://api.github.com/users/kshalnev","html_url":"https://github.com/kshalnev","followers_url":"https://api.github.com/users/kshalnev/followers","following_url":"https://api.github.com/users/kshalnev/following{/other_user}","gists_url":"https://api.github.com/users/kshalnev/gists{/gist_id}","starred_url":"https://api.github.com/users/kshalnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshalnev/subscriptions","organizations_url":"https://api.github.com/users/kshalnev/orgs","repos_url":"https://api.github.com/users/kshalnev/repos","events_url":"https://api.github.com/users/kshalnev/events{/privacy}","received_events_url":"https://api.github.com/users/kshalnev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kshalnev/omim","description":"MAPS.ME - Offline OpenStreetMap maps for iOS/Android/Mac/Linux/Windows","fork":true,"url":"https://api.github.com/repos/kshalnev/omim","forks_url":"https://api.github.com/repos/kshalnev/omim/forks","keys_url":"https://api.github.com/repos/kshalnev/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kshalnev/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kshalnev/omim/teams","hooks_url":"https://api.github.com/repos/kshalnev/omim/hooks","issue_events_url":"https://api.github.com/repos/kshalnev/omim/issues/events{/number}","events_url":"https://api.github.com/repos/kshalnev/omim/events","assignees_url":"https://api.github.com/repos/kshalnev/omim/assignees{/user}","branches_url":"https://api.github.com/repos/kshalnev/omim/branches{/branch}","tags_url":"https://api.github.com/repos/kshalnev/omim/tags","blobs_url":"https://api.github.com/repos/kshalnev/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kshalnev/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kshalnev/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/kshalnev/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kshalnev/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/kshalnev/omim/languages","stargazers_url":"https://api.github.com/repos/kshalnev/omim/stargazers","contributors_url":"https://api.github.com/repos/kshalnev/omim/contributors","subscribers_url":"https://api.github.com/repos/kshalnev/omim/subscribers","subscription_url":"https://api.github.com/repos/kshalnev/omim/subscription","commits_url":"https://api.github.com/repos/kshalnev/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/kshalnev/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/kshalnev/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/kshalnev/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/kshalnev/omim/contents/{+path}","compare_url":"https://api.github.com/repos/kshalnev/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kshalnev/omim/merges","archive_url":"https://api.github.com/repos/kshalnev/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kshalnev/omim/downloads","issues_url":"https://api.github.com/repos/kshalnev/omim/issues{/number}","pulls_url":"https://api.github.com/repos/kshalnev/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/kshalnev/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/kshalnev/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kshalnev/omim/labels{/name}","releases_url":"https://api.github.com/repos/kshalnev/omim/releases{/id}","created_at":"2015-09-30T10:46:32Z","updated_at":"2015-09-30T10:49:20Z","pushed_at":"2015-12-10T13:06:04Z","git_url":"git://github.com/kshalnev/omim.git","ssh_url":"git@github.com:kshalnev/omim.git","clone_url":"https://github.com/kshalnev/omim.git","svn_url":"https://github.com/kshalnev/omim","homepage":null,"size":1906293,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mapsme:master","ref":"master","sha":"b5474630f6127f5d34beb3ee7b5d185a6d98a07c","user":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"repo":{"id":42798033,"name":"omim","full_name":"mapsme/omim","owner":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapsme/omim","description":"MAPS.ME - Offline OpenStreetMap maps for iOS/Android/Mac/Linux/Windows","fork":false,"url":"https://api.github.com/repos/mapsme/omim","forks_url":"https://api.github.com/repos/mapsme/omim/forks","keys_url":"https://api.github.com/repos/mapsme/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapsme/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapsme/omim/teams","hooks_url":"https://api.github.com/repos/mapsme/omim/hooks","issue_events_url":"https://api.github.com/repos/mapsme/omim/issues/events{/number}","events_url":"https://api.github.com/repos/mapsme/omim/events","assignees_url":"https://api.github.com/repos/mapsme/omim/assignees{/user}","branches_url":"https://api.github.com/repos/mapsme/omim/branches{/branch}","tags_url":"https://api.github.com/repos/mapsme/omim/tags","blobs_url":"https://api.github.com/repos/mapsme/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapsme/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapsme/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapsme/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/mapsme/omim/languages","stargazers_url":"https://api.github.com/repos/mapsme/omim/stargazers","contributors_url":"https://api.github.com/repos/mapsme/omim/contributors","subscribers_url":"https://api.github.com/repos/mapsme/omim/subscribers","subscription_url":"https://api.github.com/repos/mapsme/omim/subscription","commits_url":"https://api.github.com/repos/mapsme/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapsme/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapsme/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapsme/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapsme/omim/contents/{+path}","compare_url":"https://api.github.com/repos/mapsme/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapsme/omim/merges","archive_url":"https://api.github.com/repos/mapsme/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapsme/omim/downloads","issues_url":"https://api.github.com/repos/mapsme/omim/issues{/number}","pulls_url":"https://api.github.com/repos/mapsme/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/mapsme/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/mapsme/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapsme/omim/labels{/name}","releases_url":"https://api.github.com/repos/mapsme/omim/releases{/id}","created_at":"2015-09-20T02:57:13Z","updated_at":"2015-12-10T03:11:04Z","pushed_at":"2015-12-10T13:11:36Z","git_url":"git://github.com/mapsme/omim.git","ssh_url":"git@github.com:mapsme/omim.git","clone_url":"https://github.com/mapsme/omim.git","svn_url":"https://github.com/mapsme/omim","homepage":null,"size":1943224,"stargazers_count":1521,"watchers_count":1521,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":187,"mirror_url":null,"open_issues_count":72,"forks":187,"open_issues":72,"watchers":1521,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/921"},"html":{"href":"https://github.com/mapsme/omim/pull/921"},"issue":{"href":"https://api.github.com/repos/mapsme/omim/issues/921"},"comments":{"href":"https://api.github.com/repos/mapsme/omim/issues/921/comments"},"review_comments":{"href":"https://api.github.com/repos/mapsme/omim/pulls/921/comments"},"review_comment":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapsme/omim/pulls/921/commits"},"statuses":{"href":"https://api.github.com/repos/mapsme/omim/statuses/de99778cedd4f1da26c847e6cfb7368fb51dddae"}}}}