Results 1 to 15 of 15

Thread: Why does DJGPP leave out all the good stuff?

  1. #1
    wossname
    Guest
    Help!

    Could someone please explain how to deal with strings in DJGPP C++?

    Also, I would be willing to slave myself to the person that can tell me how to do simple stuff with graphics (lines, rectangles, dots, (bitmaps would be great))

    There seems to be no provision at all for graphics in this DJGPP environment (there isn't even a graphics.h file as such!)

    I can do classes, macros and god knows what else, but graphics and strings are foreign soil to me (in C++ anyway, I can do it all in VB!).

    Any programming deities listening? Kedaman, Parksie...

    You can have my girlfriend for a week instead of me if you like!!! heh heh

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    It was only ever Borland C++ that supplied graphics.h

    To use strings:
    Code:
    #include <iostream>
    #include <string>
    
    int main() {
        string x = "Hello world!";
    
        cout << x.substr(3, 5) << endl;
        return 0;
    }
    That's standards-compliant code, so unless DJGPP is totally backwards it should work
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3
    Addicted Member Active's Avatar
    Join Date
    Jan 2001
    Location
    Lat: 13° 4' 46" N, Long: 80° 15' 20" E
    Posts
    209
    For Graphics...Try this..

    http://www.talula.demon.co.uk/allegro/
    If you can't beat your computer at chess, try kickboxing !!!
    [Download Tag Editing Tools.]

  4. #4
    wossname
    Guest
    Thanks for the input guys.

  5. #5
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    Originally posted by wossname
    Also, I would be willing to slave myself to the person that can tell me how to do simple stuff with graphics (lines, rectangles, dots, (bitmaps would be great)).
    Haha... Work, slave!!! I've got a whole OS to build . No, really, here is a link to some graphics stuff for C. It's got tutorials for normal C/C++ and separate ones for DJGPP. Try this link:

    http://www.brackeen.com/home/vga
    Designer/Programmer of the Comtech Operating System(CTOS)

  6. #6
    wossname
    Guest
    WOW!

    Warmaster, I'm mailing my girlfriend over in an unmarked crate, do with her what you will, and, yes she does!

    I will arrive next week to wash your car/bike/helicopter (delete as apropriate), plus daily removal of dog crap from your lawn from that mangy mutt down the street.

    Parksie gets all my playboy mags from the last 12 years, (I have chartered a plane especially for this) or at least the ones that bend !!! (tmi?)

    Active, you can have my dad's golf clubs, and a jet ski.

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Parksie gets all my playboy mags from the last 12 years, (I have chartered a plane especially for this) or at least the ones that bend !!! (tmi?)
    Ewww... Not really my material, I'm afraid...too commercialised
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  8. #8
    wossname
    Guest
    Just between you and me, I have a stash of "Nasty Circus Midgets", which was a cult niche in France in the mid-1920's, quite collectable now I believe. May be of interest to a conneseur!

    Heh heh

  9. #9
    Hyperactive Member Warmaster199's Avatar
    Join Date
    Aug 2000
    Location
    Canada
    Posts
    306
    I recommand that you look at VESA graphics support. Using VESA, you can set the monitor into SVGA modes and colors. It was very useful to me. The link to the VESA site is:

    www.vesa.org

    Look at the VBE 3.0 specifications. There is an adobe acrobat file that has source code in it.


    Originally posted by parksie
    It was only ever Borland C++ that supplied graphics.h
    I've got an old(ish) kind of compilier called PowerC. It contains a Graphics.h and graphics functions as well.
    Designer/Programmer of the Comtech Operating System(CTOS)

  10. #10
    denniswrenn
    Guest
    Originally posted by parksie
    It was only ever Borland C++ that supplied graphics.h

    To use strings:
    Code:
    #include <iostream>
    #include <string>
    
    int main() {
        string x = "Hello world!";
    
        cout << x.substr(3, 5) << endl;
        return 0;
    }
    That's standards-compliant code, so unless DJGPP is totally backwards it should work
    Don't you need to add using namespace std? Or at least 'using' the namespaces you are... well, using? (std::string, std::cout, std::endl).

  11. #11
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You're right...I've answered the questions about the STL so many times now my brain's gone into melt-down over it.

    This, of course, is why we need a FAQ.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  12. #12
    denniswrenn
    Guest
    Why don't you write a FAQ, or at least start writing one. Then talk to John about posting an Anouncement only for the C++ forum that will serve as a FAQ?

  13. #13
    wossname
    Guest
    Okay, I've workied out how to use strings in the most simple sense, but now I need to change a character somewhere in the string...

    Code:
    string MyString = "Hello World";
    string RandomSetOfChars = "abcdef";
    
    /* i want to change the "e" in hello to another character
    but this doesn't seem to do it...*/
    
    MyString.substr(1,1) = RandomSetOfChars.subset(random()%6,1);
    The character never changes. Is there an equivalent of VB's Mid$() function in the string class?

    Maybe I should re-title this thread to: "Why does DJGPP leave out all the documentation?" !


  14. #14
    denniswrenn
    Guest
    Mid is basicly the same as substr...

    Code:
    string str = "hello";
    string str2 = str.substr(2,2); //str2 now equals ll
    the first parameter is the starting point, the second is the depth.

  15. #15
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    To access a character directly in the string, just use the [] array operators:
    Code:
    string x = "Hello";
    
    x[3] = "z"; // x = "Helzo"
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

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