Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

115 Neutral

About mago

  • Rank
  1. In Visual C++, there was a linker option /SWAPRUN:NET that would cause the exe to be executed from the swap rather than directly from its location. How do I do this in C#/.NET? Or, if it's not possible, how do I create an exe file that can be overwritten even when other users currently run the application? Thanks in advance for any ideas
  2. mago

    Killing a stack

    I would do the recursion for this problem like this: Check left, if returns 'exit found', return 'exit found' Check right, if returns 'exit found', return 'exit found' Check forward, if returns 'exit found', return 'exit found' return 'exit not found' this assumes that one of the arguments of the function is 'where I came from' and the 'left', 'right' and 'forward' are calculated relatively to it.
  3. mago

    Engine Design: Does This Make Sense?

    have you heard of what is called a Singleton design pattern? You could use it for your manager classes.
  4. mago

    a stupid header file question.

    Dude, if you don't have <windows.h>, you should reinstall VS completely as there is a chance that other files will be missing
  5. int i=0; int myArray[100]; FILE* f = fopen("myfile", "rt"); while (!feof(f)) { fscanf(f, "%i", &(myArray[i++])); }; &(myArray[i++]) returns the address of the i-th element of the array and then increases i by 1
  6. mago

    c++ LPCTSTR problem

    Using functions designed to work with TCHAR would be even better... LPCTSTR data type is a macro that evaluates to char* const if _UNICODE is not defined and to wchar_t* const if _UNICODE is defined. When you put an L before your string constant, you are making it Unicode, whether _UNICODE is defined or not. What you should do instead is use TEXT() macro, which converts your string constants to Unicode only if _UNICODE is defined. You would than call your function like this: int n = _stprintf(text,TEXT("Coordinates: [%d][%d]"),x,y); DrawText( hDC,text, -1, &rcString1, DT_LEFT|DT_WORDBREAK ); Note that DrawText() is also a macro and it evaluates to DrawTextA() (for ANSI) when _UNICODE is not defined and to DrawTextW() (for Unicode) if it is, like most win32api functions
  7. mago

    linecount in fstream

    First of all, ifstream readfile (string("Level/Level1.txt").c_str()); is nonsense.. ifstream readfile ("Level/Level1.txt"); is faster, smaller and safer, and does the same job. Second, you want to use something like while (!EndOfFile(file)) do .... I don't know how it's done with streams though.. also, you might be interested in this
  8. mago

    Reading/Writing Files in C++

    I have actually made a library that reads a line or a field from a text file into an STL string, so you can do whatever with it afterwards. And you don't have to use streams at all.. The library and an article about it can be found on CodeProject
  9. To keep your source files, executables, object files, etc. in separate directories, you need to change the approperiate settings in the Project Settings. I do the same thing (desktop<->notebook), though, and the best thing I could come up with is have the same directory structure on both machines..
  10. mago

    Posting files

    There is a lot of websites that will host your files for free, just do a google search for "free hosting"
  11. mago

    Where to start...?

    C++. We tell beginners to start with Basic all the time, so that they learn the basics of programming before attempting to use a language as complex as c++. You say you know basic already, so it seems to me that the next natural step would be c++. Once you master this, adopting to another language is much easier.
  12. mago

    Putting a varible for a file name

    jfclavette forgot to say that you need to #include <string>. Another option, if you don't want to use STL is char* fileName = "test.bmp"; g_pddsone = DDLoadBitmap(g_pdd,fileName,0,0);
  13. When you create a window, you provide it with a Window Procedure. This procedure then receives messages from the operating system. What you need to do is react to the WM_PAINT message. When you receive WM_PAINT, you do this: case WM_PAINT: PAINTSTRUCT ps; HDC hdc; hdc = BeginPaint(hWnd, &ps); // here you can do the actual painting, for example // SetPixel(hdc, x, y, color): SetPixel(hdc, 20, 20, RGB(0,0,255)); // blue pixel on (20,20) EndPaint(hWnd, &ps); break; good luck and please ask if you don't understand what I'm talking about..
  14. look here:
  15. mago

    What does "DIB" stand for?

    DIB stands for "Device Independent Bitmap" EDIT: 16 seconds, damn it! :)
  • 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!