oh the fun of strings....

This is a discussion on oh the fun of strings.... within the Windows Programming forums, part of the Platform Specific Boards category; Okay, I am making a Real Time Strategy game engine. It's going very well, and if you want to see ...

  1. #1
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738

    Post oh the fun of strings....

    Okay, I am making a Real Time Strategy game engine.
    It's going very well, and if you want to see a demo, I can send one to you...but anyways, thats not the point.

    I was changing up some code in the engine to optimize it. I had hardcoded in some file loading processes to get it to work for a presentation, and now I am optimizing the file loading processes.

    Basically, I have a set of "x" amount of bitmaps, targas, etc., each one acting as one frame in an animation.

    the naming sequence is like this:

    bob0001.bmp
    bob0002.bmp
    .....
    bob10000.bmp
    bob10001.bmp
    .....

    So, I decided to just use a couple simple for loops to manipulate the string easily so I would not have to type out every filename.

    At first I included cstring.h, which shuld have the standard string class in it, but that did not work. Visual C++ got angry at me and did not let me include it. So I looked at the include files and saw one called cstring, but with no file extension, so I included that one. Visual C++ got angry at me again, saying that the data type "string" did not exist. So then I looked in the cstring file, and it was nothing like cstring.h I had found in every other compiler I had ever used. It didnt even contain the standard string class.

    So then I tried using normal char* and string.h, but that proved to be a difficult task and the computer hated me.

    So I checked the Visual C++ help files for some type of string class, and found just the thing I was looking for, the CString class in afx.h. So I included it, and I used it.
    However, when I tried to compile, it told me that the CString class could only be used in MFC applications. My game engine isnt MFC and never will be MFC.

    So what do you suggest I do?
    My Website

    "Circular logic is good because it is."

  2. #2
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    isn't a string a standard C++ data type?

  3. #3
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    Not that I know of.

    Whenever I declared a string (the type that is in cstring.h), and used the . notation to get to one of its member functions, VC++ would pop up the window of member variables and functions like it does for classes that it knows about, but then when I tried to compile it, it said it didnt know about that data type...
    My Website

    "Circular logic is good because it is."

  4. #4
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    Did you use the infamous "Using namespace std;" line after your include ?

    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  5. #5
    l'Anziano DavidP's Avatar
    Join Date
    Aug 2001
    Location
    Plano, Texas, United States
    Posts
    2,738
    yeah, i tried using it, and it didnt work. i also tried not using it, and it didnt work.

    I have no based myself to using the utterly horrid apstring class. It's barbaric and menial ways should suffice for my purposes.
    My Website

    "Circular logic is good because it is."

  6. #6
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,230
    string isn't standard?

    Heh, can you tell I do almost all C and practically 0 C++?

  7. #7
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    have you tried with the stl string type... you know...

    #include <string>
    using namespace std;
    string s="This is a STL string";

    blah blah
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strings Program
    By limergal in forum C++ Programming
    Replies: 4
    Last Post: 12-02-2006, 02:24 PM
  2. Programming using strings
    By jlu0418 in forum C++ Programming
    Replies: 5
    Last Post: 11-26-2006, 07:07 PM
  3. Reading strings input by the user...
    By Cmuppet in forum C Programming
    Replies: 13
    Last Post: 07-21-2004, 06:37 AM
  4. Arrays of Strings are fun
    By kippwinger in forum C++ Programming
    Replies: 9
    Last Post: 07-02-2003, 04:12 PM
  5. menus and strings
    By garycastillo in forum C Programming
    Replies: 3
    Last Post: 04-29-2002, 11:23 AM

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