Thread: writing to a char buffer as a FILE*

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Note that fmemopen is not part of the C or C++ standard library.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Registered User
    Join Date
    Oct 2006
    Posts
    3,445
    you posted in the C++ forum. why not just use std::stringstream? it does exactly what you want, and unless your requirement is to use the archaic C-style FILE*, you'll be much better off doing it the C++ way.

  3. #18
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Elkvis
    why not just use std::stringstream? it does exactly what you want, and unless your requirement is to use the archaic C-style FILE*, you'll be much better off doing it the C++ way.
    Because in post #4...
    Quote Originally Posted by Opply
    If I could change the function, I would, but it is a part of a bigger system and I am not allowed to modify it..
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I am writing a string to an excel file a char per cell
    By jeremy duncan in forum C++ Programming
    Replies: 10
    Last Post: 05-12-2012, 02:09 AM
  2. Replies: 8
    Last Post: 12-22-2011, 10:24 PM
  3. writing a file from buffer
    By mariano_donati in forum C Programming
    Replies: 8
    Last Post: 02-25-2008, 02:04 AM
  4. Writing to screen buffer.
    By h3ro in forum Game Programming
    Replies: 4
    Last Post: 01-15-2008, 07:23 AM
  5. writing char arrays to a file
    By cpluspluser in forum C++ Programming
    Replies: 2
    Last Post: 05-26-2003, 11:17 PM