Thread: Getting by DOS text limit

  1. #1
    Registered User
    Join Date
    Nov 2002
    Posts
    48

    Question Getting by DOS text limit

    Hello,

    I am making a HTML generator, and the user needs to enter the body of thier page. The problem is that DOS doesn't let you enter more then about 3.5 lines. How can I get by this and let them enter as much text as needed?

    Thanks

  2. #2
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Get the user to store their data in a file first, then read that instead.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  3. #3
    Registered User
    Join Date
    Nov 2002
    Posts
    48
    Two problems with that...

    1) I don't know ho to read files like that.

    2) I want it to be done in the program its self.

  4. #4
    Registered User
    Join Date
    Sep 2002
    Posts
    417
    read it character by character using getch and a string (#include <string>)?

  5. #5
    Registered User
    Join Date
    Nov 2002
    Posts
    48
    Can you give me an example please?

  6. #6
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361
    Or you could read it line by line... something like this:
    Code:
    #include <string>
    #include <list>
    #include <iostream>
    
    using namespace std;
    
    // Get user to input body of page
    
    list<string> userBody;
    string tempLine;
    
    cout << "Please enter the body of your page. Press enter twice to exit: ";
    
    while (getline(cin, tempLine))
         userBody.push_back(tempLine);
    
    // userBody now contains the body of the users HTML page.
    If you're feeling really ambitious (and have the SGI STL extensions available) you could use a rope instead of a list<string>. Good luck.

  7. #7
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Code:
    #include<iostream.h>
    int main()
    {
    	char letter,TERMCHAR;
    
    	...
    	
    	while(cin>>letter&&letter!=TERMCHAR)
    	{
    		...
    	}
    
    	...
    }
    that will take it in one character at a time, until TERMCHAR (you define it) is reached...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  2. Text Enhancement from DOS console
    By 3DMatrix in forum C++ Programming
    Replies: 8
    Last Post: 06-06-2004, 08:12 AM
  3. Some DOS text questions :)
    By Dan_Rzn in forum C++ Programming
    Replies: 20
    Last Post: 04-17-2003, 03:06 PM
  4. mygets
    By Dave_Sinkula in forum C Programming
    Replies: 6
    Last Post: 03-23-2003, 07:23 PM
  5. static text in DOS
    By Goof Program in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-29-2002, 02:57 PM