Thread: boldface, underline in file output

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    8

    boldface, underline in file output

    can I output boldface and underlined characters to a
    file in C++? How?
    I see that normal ASCII does not include boldface or
    underlined characters. Right now I am using standard
    C++ stream libraries. <fstream> <iomanip> etc. on
    Microsoft Visual C++. I am not using "printf"-type functions,
    only "<<" operators.
    Any Info would be helpful.

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    114
    See the output file as a pure binary text file. If you view it in notepad you will see the pure text in the file unformated. If you open a MS Word document in notepad it will look like rubbish. Why? They have textformating in the document, telling them how the document shall look in Word. So what do you have to do first? Decide on a file format to use. I suggest u look how the RTF-file, and its textformating to understand how it is done. Or take HTML as an example:

    Code:
    (i assume you know your file open/close/writing)
    
    // fFile is the file handle to my html file
    fprintf(fFile, "<b>hello internet</b>");
    Now I have writen an html file that looks like this in notepad:

    <b>hello internet</b>

    and like this in any webbrowser:

    hello internet

    Hope I didn't totaly missunderstand your question, and that my answer helped!

  3. #3
    Registered User
    Join Date
    Feb 2002
    Posts
    25

    formatted text

    you will probably have to use the gdi objects

    Device context and the like in combination with
    the Logical fonts LOGFONT ... which allows you to set many attibutes...such as strike out and underline...
    inZane
    --true programmer's don't comment--
    --programmer wannabes complain about it--

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Base converter libary
    By cdonlan in forum C++ Programming
    Replies: 22
    Last Post: 05-15-2005, 01:11 AM
  2. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  3. simulate Grep command in Unix using C
    By laxmi in forum C Programming
    Replies: 6
    Last Post: 05-10-2002, 04:10 PM
  4. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM
  5. Simple File Creation Algorithm
    By muffin in forum C Programming
    Replies: 13
    Last Post: 08-24-2001, 03:28 PM