Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About Aerts

  • Rank
  1. I know some functions that do this but what is the easiest way to get in the end smth. that looks like: Day is Wednesday Month is May Year is 2004
  2. Aerts

    header guard

    I know that the header guard is useful (either in #pragma or in #ifndef shape) but I don't know *why* is it useful- more to the point what errors could it produce. I tried once to #include a guardless header in all of the cpp's of my project but no error occured. So please post a small sourcecode that causes an error because the header lacks header guards.
  3. Aerts

    undeclared modifier problem

    I did that and got the error: "test2.obj : error LNK2005: "struct employee worker" (?worker@@3Uemployee@@A) already defined in test.obj Debug/test.exe : fatal error LNK1169: one or more multiply defined symbols found".
  4. I tried to make my 1st multiple-sourcefile project (that is, more than one .cpp). I get 3 errors, the 1st is: "test.cpp(20) : error C2065: 'worker' : undeclared identifier". What is wrong? test.cpp: #include <iostream> #include <fstream> #include <math.h> #include <stdlib.h> #include <windows.h> #include <conio.h> #include <iomanip> #include <string> #include "head.h" using namespace std; void main() { cout<<<<endl<<worker.salary<<endl; } test2.cpp: #include <iostream> #include <fstream> #include <math.h> #include <stdlib.h> #include <windows.h> #include <conio.h> #include <iomanip> #include <string> #include "head.h" employee worker(33,123.45); head.h: using namespace std; struct employee { employee(int name,double salary) { name = name; salary = salary; } int name; double salary; };
  5. Aerts

    Why pointer

    I have a C++ book with sourcecode for a game example. The game's core variables and methods are all inside a class called GameEngine. To access all those, an object has been created: _pGame. But instead of: GameEngine _pgame;... it was declared like this: GameEngine* _pGame; (the small 'p' stands for pointer). My questions are: 1)why make it a pointer when a regular object could access all members just as well? 2)further along the book is implemented class Bitmap (with bmp-specific methods). All objects of class Bitmap are also pointers. Why?
  6. I want to make a game (with sprites, sound etc.) But I'd like to make it in a console project (something that resembles DOS). Some people told me it's impossible because console projects can't display bitmaps (I need bitmaps), only pure Win32 projects can do this. Is it true?
  7. I want to write to a file that already has stuff in it. I'm using ios::app but what I need is both: 1. to not erase any of the file 2. to append to a specified offset (NOT the end of file). When I use ios::app, seekp() won't work. And when I don't use ios::app some text gets erased. What can I do?
  8. Aerts

    resources in exe- a question

    But if it is so why aren't all the demanding newest shooters delivered in one big exe?
  9. I wondered many times about this: if I were to insert all my resources inside my C++ project (thus inside my executable), would this big exe be slower to load than if I were to have a small exe and all resources in a directory?
  10. Aerts

    too big number

    To Rogalon: I just created a program that reads a player's health from a file and just thought to try it for fun. To Fred304: This is roughly my code: int health; ifstream ifs;"player_health.txt"); ifs>>health;
  11. Aerts

    too big number

    I have a number that's 30 digits big. Which C++ variable type can properly store it? I've tried long unsigned, long and double without luck.
  12. Please show me, in a small (but full) C++ program how to make a function that returns a structure. For example, modify the modf(...) function so that instead of returning the integer part and assigning the fractionary part to the 2nd parameter, it will fill a structure with these 2 values. Thanks.
  13. I know about char* _strlwr(char*) but what I want is to be able to use this with a string variable, like: string strg; I tried it but it gives me a "cannot convert class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > to char*" error. What can I do?
  14. Aerts

    level file

    To Squirm: it's the first time I try to read a mapfile (the game that uses it is win32 console, without SDL, Allegro etc- a text game). All I need is a program that can read this: health 100 ammo 50 damage 10 I need to know: 1 HOW to read the file: char-by-char or line by line, using delimitators? 2 how to handle whitespaces, newlines etc. Also I'd appreciate links to some tutorials- I've searched but only found advanced tutorials/sourcecode. Thanks.
  15. Aerts

    level file

    I'm trying to make a C++ program that reads text (.txt) files. The text files are meant to represent the various things found in a game level (map). I need: 1)if possible a complete sourcecode that does this (or a link) or/and 2)some pointers about how to do this- especially what function/methods/structures to use.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!