Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

C++ Madness: File I/O with "char"

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
3 posts • Page 1 of 1
Author
Message
wswartzendruber
Veteran
Veteran
User avatar
Posts: 1261
Joined: Tue Mar 23, 2004 1:16 am
Location: Idaho, USA

C++ Madness: File I/O with "char"

  • Quote

Post by wswartzendruber » Mon Sep 01, 2014 10:50 pm

libogg is giving me "unsigned char*" buffers that I need to send to an ofstream.

PROBLEM: <ofstream> takes char*, not unsigned char*.

Can I just use reinterpret_cast<char*> on these things? That seems like a really, really bad idea.

EDIT: How the hell does a signed char map to the extended ASCII table, anyway?

EDIT: Who the fuck thought of this?!
Top
Hu
Administrator
Administrator
Posts: 24380
Joined: Tue Mar 06, 2007 5:38 am

  • Quote

Post by Hu » Tue Sep 02, 2014 12:39 am

Why are you sending it to an ofstream? You probably want to write the data through unmodified, so use write. File streams take char* because they are mostly used with printable text and historically, printable text was char* and more recently const char*.
Top
046
Apprentice
Apprentice
Posts: 231
Joined: Wed Jul 21, 2004 10:22 am
Location: Yaroslavl, Russia

Re: C++ Madness: File I/O with "char"

  • Quote

Post by 046 » Tue Sep 02, 2014 11:52 am

wswartzendruber wrote:libogg is giving me "unsigned char*" buffers that I need to send to an ofstream.
PROBLEM: <ofstream> takes char*, not unsigned char*.
Can I just use reinterpret_cast<char*> on these things? That seems like a really, really bad idea.
Use cast, it is ok really.
Top
Post Reply

3 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy