Thread: text output in text editor

  1. #1
    Registered User
    Join Date
    Oct 2005
    Posts
    11

    text output in text editor

    Hello.

    All of our class projects thus far have been console apps. I have had a problem displaying output correctly on my laptop but on the desktops, they look fine.

    For instance on the last project we had to output a graph. When I designed at home on desktop it looks great but then I put it on my laptop it was a mess. I took it to school and it displayed perfect there.

    I'm now working with arrays and I think a space and tab are not being translated correctly. If I put a space or tab in the data file when I debug it shows the index as hex value 9.

    Anyone else experience this? I'm wondering if I have a setting in my OS that I need to change.

    Thanks.

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Tabs aren't always the same width. I prefer to use spaces.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Oct 2005
    Posts
    11
    Quote Originally Posted by dwks
    Tabs aren't always the same width. I prefer to use spaces.
    I can agree but the problem I have is that when I use a space on the laptop it's translated to HEX value 9 and not 32. I'm not sure why.

  4. #4
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    Do spaces get converted to tabs? What editor are you using to insert the spaces? Or do you do it C++-wise?

    [edit]
    Wait, you said "output". Just regular cout?
    [/edit]
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  5. #5
    Registered User
    Join Date
    Oct 2005
    Posts
    11
    Quote Originally Posted by dwks
    Do spaces get converted to tabs? What editor are you using to insert the spaces? Or do you do it C++-wise?

    [edit]
    Wait, you said "output". Just regular cout?
    [/edit]
    The output from the previous projects were output using ofstream.

    The input that I'm using is from ifstream. I have formated the data both ways using tabs and spaces and when I debug the project shows the character encountered as a tab everytime.

    They don't appear to be converted because I output the raw data before doing anything to it, the raw data appears like:

    3 5 + //with spaces
    3 5 + //with tabs

    but when I come to the index holding the value it's always a HEX 9 and never 32.

    I'm going to try on my desktop when I get home and see what it reports on that system.

    Thanks for the help.

  6. #6
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    My laptop has never had that happen before, is this specific to certain brands/OS's?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Having trouble making a function do what I want.
    By Shamino in forum C++ Programming
    Replies: 9
    Last Post: 12-07-2007, 11:20 AM
  2. sorting characters and output to text file
    By odb1 in forum C++ Programming
    Replies: 1
    Last Post: 10-10-2003, 04:46 PM
  3. Text editor with font color
    By KingoftheWorld in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 01-15-2003, 01:45 PM
  4. Urgent: output editable text to dos
    By samohx in forum C Programming
    Replies: 4
    Last Post: 09-27-2002, 12:25 PM