Like Tree2Likes

Problem with strings in Turbo C

This is a discussion on Problem with strings in Turbo C within the C++ Programming forums, part of the General Programming Boards category; Originally Posted by Elkvis those would be great if this were C, but this is C++, so it should be ...

  1. #16
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,594
    Quote Originally Posted by Elkvis View Post
    those would be great if this were C, but this is C++, so it should be more like this:
    Code:
    char* word = new char[100];
    cin >> word;
    delete[] word;
    Inadvisable.
    This is prone to buffer overflows. Use std::getline or simply std::string.
    Same applies for arrays on the stack.

    In any case, if the teacher forces you to use Turbo C(++) and void main and other non-standard crap, then I think it is a good idea to drop the course, unless it's a requirement.
    Learning outdated tools will not help you in real life in any way or form.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Registered User
    Join Date
    Oct 2006
    Posts
    2,402
    Quote Originally Posted by Elysia View Post
    Inadvisable.
    definitely, but the point was to demonstrate the C++ way of doing what CommonTater was demonstrating.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Graphics problem in turbo c++
    By mushahidh in forum Game Programming
    Replies: 1
    Last Post: 10-31-2010, 08:22 AM
  2. Turbo C++, Convertion problem
    By paulroseby in forum C Programming
    Replies: 4
    Last Post: 05-08-2003, 04:23 PM
  3. I have a problem with turbo c++ v3.0
    By leeng_viper in forum C Programming
    Replies: 1
    Last Post: 12-22-2002, 01:16 PM
  4. Replies: 0
    Last Post: 09-25-2002, 04:34 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21