CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Dec 2010
    Posts
    907

    iostream.h vs iostream (the old and new functions)

    I am trying to port an old application from unix to win32.
    The program was called C++ Sim
    In that program, it uses iostream.h extensively which doesn't conform to
    the new C++ standard library.
    The functions that I found no longer supported are
    1) setb()
    2) base()
    3) allocate()
    4) ebuf()
    and so on.
    What is the quickest way to convert all these calls and make them conform to the new C++ standard library?
    Thanks
    Jack

  2. #2
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: iostream.h vs iostream (the old and new functions)

    Understand the code and then write the (near) equivalent code using the standard library (or other libraries, if necessary).
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  3. #3
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: iostream.h vs iostream (the old and new functions)

    Some of these are documented on MSDN (eg setb and ebuf). Search on http://msdn.microsoft.com/en-US/#fbid=xs73WvvEHZg
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  4. #4
    Join Date
    Dec 2010
    Posts
    907

    Re: iostream.h vs iostream (the old and new functions)

    I see. But those functions are not supported by the 7.0a SDK.
    They are only available with Visual C++ 6.0.

    http://msdn.microsoft.com/en-us/libr...=vs.60%29.aspx

    which turns out to be quite hairy.
    Where can I find a mapping table for legacy names and the new names for these changes?
    Thanks
    Jack
    Last edited by lucky6969b; June 10th, 2014 at 04:53 AM.

  5. #5
    2kaud's Avatar
    2kaud is offline Super Moderator Power Poster
    Join Date
    Dec 2012
    Location
    England
    Posts
    7,824

    Re: iostream.h vs iostream (the old and new functions)

    I see. But those functions are not supported by the 7.0a SDK.
    They are only available with Visual C++ 6.0.
    Yes, but at least you will have an idea from the documentation as to their function.

    Where can I find a mapping table for legacy names and the new names for these changes?
    I doubt there is one as it's not just name changes from unix legacy to ansi c++ but functionality as well as per laserlight's post #2.
    All advice is offered in good faith only. All my code is tested (unless stated explicitly otherwise) with the latest version of Microsoft Visual Studio (using the supported features of the latest standard) and is offered as examples only - not as production quality. I cannot offer advice regarding any other c/c++ compiler/IDE or incompatibilities with VS. You are ultimately responsible for the effects of your programs and the integrity of the machines they run on. Anything I post, code snippets, advice, etc is licensed as Public Domain https://creativecommons.org/publicdomain/zero/1.0/ and can be used without reference or acknowledgement. Also note that I only provide advice and guidance via the forums - and not via private messages!

    C++23 Compiler: Microsoft VS2022 (17.6.5)

  6. #6
    Join Date
    Dec 2010
    Posts
    907

    Re: iostream.h vs iostream (the old and new functions)

    Okay, I tried to exclude that file because nobody was using it, it compiles now,
    thanks

  7. #7
    Join Date
    Dec 2010
    Posts
    907

    Re: iostream.h vs iostream (the old and new functions)

    Hello folks,
    I have narrowed down from about 30 compilation errors to 1 compilation error which relates to
    the unix task.h header file. I sort of google and cannot find good info on it.
    Code:
    /*
     * Copyright (C) 1994-1997, 1998,
     *
     * Department of Computing Science,
     * The University,
     * Newcastle upon Tyne,
     * UK.
     *
     * $Id: cpp_task.h,v 1.2 1998/08/28 14:19:34 nmcl Exp $
     */
    
    #ifndef CPP_TASK_H_
    #define CPP_TASK_H_
    
    #include <task.h>
    
    #ifndef BOOLEAN_H_
    #  include "Boolean.h"
    #endif
    
    #ifndef THREAD_H_
    #  include "thread.h"
    #endif
    
    class ostream;
    
    /*
     * General notes: the C++ Task library does not have any notion of priorities,
     * and as such we need to simulate them (not too difficult).
     */
    
    /*
     * A simple semaphore class based on the one in the Cfront 2.1 release notes.
     */
    
    class _semaphore : public object
    {
    public:
        _semaphore ();
        ~_semaphore ();
    
        int pending ();
        void wait ();
        void signal ();
    
    private:
        int sigs;	// the number of excess signals
    };
    
    
    /*
     * We do this because multiple (single) inheritence doesn't work
     * (setjmp/longjmp limitations).
     * Although multiple inheritence does, we should still support
     * older versions of C++, so ...
     */
    
    class Basic_Task : public task
    {
    public:
        Basic_Task (Thread*, long, int = SIZE);
        virtual ~Basic_Task ();
    
        _semaphore sem;
    };
    
    /*
     * This is a threads interface to the C++ task library.
     */
    
    class ThreadData
    {
    public:
        ThreadData ();
        ~ThreadData ();
        
        Basic_Task* my_block;
    
        static long base_key;
        static task* _mainTask;
        static long mainTaskID;
    };
    
    class CPP_Mutex : public Mutex
    {
    public:
        CPP_Mutex ();
        ~CPP_Mutex ();
    
        Boolean lock ();
        Boolean unlock ();
    
    private:
        _semaphore _theLock;
    };
    
    #endif
    Any help would be greatly appreciated!
    Thanks
    Jack

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured