{"action":"opened","issue":{"url":"https://api.github.com/repos/scala-native/scala-native/issues/451","repository_url":"https://api.github.com/repos/scala-native/scala-native","labels_url":"https://api.github.com/repos/scala-native/scala-native/issues/451/labels{/name}","comments_url":"https://api.github.com/repos/scala-native/scala-native/issues/451/comments","events_url":"https://api.github.com/repos/scala-native/scala-native/issues/451/events","html_url":"https://github.com/scala-native/scala-native/issues/451","id":196634670,"number":451,"title":"X86: fwrite fails to output, fprintf & fputs succeed.","user":{"login":"LeeTibbert","id":12221035,"avatar_url":"https://avatars.githubusercontent.com/u/12221035?v=3","gravatar_id":"","url":"https://api.github.com/users/LeeTibbert","html_url":"https://github.com/LeeTibbert","followers_url":"https://api.github.com/users/LeeTibbert/followers","following_url":"https://api.github.com/users/LeeTibbert/following{/other_user}","gists_url":"https://api.github.com/users/LeeTibbert/gists{/gist_id}","starred_url":"https://api.github.com/users/LeeTibbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LeeTibbert/subscriptions","organizations_url":"https://api.github.com/users/LeeTibbert/orgs","repos_url":"https://api.github.com/users/LeeTibbert/repos","events_url":"https://api.github.com/users/LeeTibbert/events{/privacy}","received_events_url":"https://api.github.com/users/LeeTibbert/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-12-20T10:17:01Z","updated_at":"2016-12-20T10:17:01Z","closed_at":null,"body":"For if/when X86 support becomes possible. \r\n\r\nI have managed to find the proximal cause of my zero\r\noutput from println in the \"Getting Started\" tutorial example.\r\n\r\nThe C function fwrite is used by \r\njavalib/src/main/scala/java/lang/System.scala#CFileOutputStream,\r\nwhich println eventually calls.\r\n\r\nIt seems that scala-native fwrite gives zero output, causing\r\nthe behavior I was seeing.\r\n\r\nfprintf and fputc work just fine, both with file I/0\r\nand stdout. demo/native/smallpt.scala uses fprintf and works!\r\nSurprisingly, to me, fputc works also, I would have expected\r\nthat to translate immediately to a call to fwrite.\r\n\r\nfwrite in a C program works just fine.\r\n\r\nIn examining the code, the major difference I see between\r\nfwrite & the calls that work is that fwrite takes two CSize\r\nparameters.  I tried various ways (strlen, cast, etc.) of \r\nspecifying those parameters and could not figure it out.\r\n\r\nWhen I hack my local copy of CFileOutputStream to use\r\nfputc, the example program works for me.  Better yet,\r\nI can run the test suite in unit-tests and see something\r\nuseful. Yeah!\r\n\r\nI hope this report is useful to you.\r\n\r\nLee\r\nhappily running on my locally published copy"}}
{"actor":{"display_login":"LeeTibbert"}}