{"action":"created","issue":{"url":"https://api.github.com/repos/msharov/ustl/issues/45","labels_url":"https://api.github.com/repos/msharov/ustl/issues/45/labels{/name}","comments_url":"https://api.github.com/repos/msharov/ustl/issues/45/comments","events_url":"https://api.github.com/repos/msharov/ustl/issues/45/events","html_url":"https://github.com/msharov/ustl/issues/45","id":126372022,"number":45,"title":"ustl::ostream do not accept char string","user":{"login":"mingodad","id":462618,"avatar_url":"https://avatars.githubusercontent.com/u/462618?v=3","gravatar_id":"","url":"https://api.github.com/users/mingodad","html_url":"https://github.com/mingodad","followers_url":"https://api.github.com/users/mingodad/followers","following_url":"https://api.github.com/users/mingodad/following{/other_user}","gists_url":"https://api.github.com/users/mingodad/gists{/gist_id}","starred_url":"https://api.github.com/users/mingodad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mingodad/subscriptions","organizations_url":"https://api.github.com/users/mingodad/orgs","repos_url":"https://api.github.com/users/mingodad/repos","events_url":"https://api.github.com/users/mingodad/events{/privacy}","received_events_url":"https://api.github.com/users/mingodad/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/msharov/ustl/labels/rejected","name":"rejected","color":"ffffff"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-13T09:03:56Z","updated_at":"2016-01-13T14:15:03Z","closed_at":"2016-01-13T14:15:03Z","body":"Hello !\r\nThe program bellow shows the problem (it works with std):\r\nCheers !\r\n```\r\n#define USE_STD2\r\n#ifdef USE_STD\r\n#include <iostream>\r\n#include <sstream>\r\nusing namespace std;\r\n#else\r\n#include <ustl.h>\r\nusing namespace ustl;\r\n#endif // USE_STD\r\n\r\nostream &addChar(ostream &os)\r\n{\r\n    os << \"I'm a char string\";\r\n    return os;\r\n}\r\n\r\nint main()\r\n{\r\n    ostringstream ss;\r\n    addChar(ss);\r\n    return 0;\r\n}\r\n```\r\n```\r\n||=== Build: Release in test (compiler: GNU GCC Compiler) ===|\r\n../../../../../../local/include/ustl/ulimits.h||In instantiation of ‘struct ustl::numeric_limits<char [18]>’:|\r\n../../../../../../local/include/ustl/mostream.h|260|required from ‘ustl::ostream& ustl::operator<<(ustl::ostream&, const T&) [with T = char [18]]’|\r\nmain.cpp|13|required from here|\r\n../../../../../../local/include/ustl/ulimits.h|25|error: function returning an array|\r\n../../../../../../local/include/ustl/ulimits.h|26|error: function returning an array|\r\n||=== Build failed: 2 error(s), 3 warning(s) (0 minute(s), 0 second(s)) ===|\r\n```"},"comment":{"url":"https://api.github.com/repos/msharov/ustl/issues/comments/171302364","html_url":"https://github.com/msharov/ustl/issues/45#issuecomment-171302364","issue_url":"https://api.github.com/repos/msharov/ustl/issues/45","id":171302364,"user":{"login":"msharov","id":3843835,"avatar_url":"https://avatars.githubusercontent.com/u/3843835?v=3","gravatar_id":"","url":"https://api.github.com/users/msharov","html_url":"https://github.com/msharov","followers_url":"https://api.github.com/users/msharov/followers","following_url":"https://api.github.com/users/msharov/following{/other_user}","gists_url":"https://api.github.com/users/msharov/gists{/gist_id}","starred_url":"https://api.github.com/users/msharov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/msharov/subscriptions","organizations_url":"https://api.github.com/users/msharov/orgs","repos_url":"https://api.github.com/users/msharov/repos","events_url":"https://api.github.com/users/msharov/events{/privacy}","received_events_url":"https://api.github.com/users/msharov/received_events","type":"User","site_admin":false},"created_at":"2016-01-13T14:15:03Z","updated_at":"2016-01-13T14:15:03Z","body":"This code is incorrect. uSTL ostream is a binary stream and the addChar's behavior is undefined. You can use os << string(\"\") to write the data as a string. Or you could say os.write (\"str\", sizeof(\"str\")) to write as a null-terminated string. Or you could write just the char array without the null-terminator.\r\n\r\nThe correct way to do the above is to use ostringstream argument to addChar. `ostringstream& addchar (ostringstream& os)`."}}