jonathanYoung 0 Newbie Poster

allrighty, this MAY take a bit to answer, but i have here a standard visual c++ function that clears the screen, i found off the internet. what i need, is some help knowing what all the different functions inside do.... since codes useless unless you know what it does :)
note: when i try looking up each individual function on google, i find that it sends me right back to were i got this code from.

void clearscreen()
{
HANDLE hndl = GetStdHandle(STD_OUTPUT_HANDLE);
	CONSOLE_SCREEN_BUFFER_INFO csbi;
	GetConsoleScreenBufferInfo(hndl, &csbi);
	DWORD written;
	DWORD n = csbi.dwSize.X * csbi.dwCursorPosition.Y + csbi.dwCursorPosition.X + 1;	
	COORD curhome = {0,0};
	FillConsoleOutputCharacter(hndl, ' ', n, curhome, &written);
	csbi.srWindow.Bottom -= csbi.srWindow.Top;
	csbi.srWindow.Top = 0;
	SetConsoleWindowInfo(hndl, TRUE, &csbi.srWindow);
	SetConsoleCursorPosition(hndl, curhome);
}
jonathanYoung 0 Newbie Poster

again, thanks, i did not know you could concat strings that way,
i thought it didn't go much farther than strstring + strstring2

jonathanYoung 0 Newbie Poster

all right, i believe the only way is to actually post the code.
i don't think its TOO long;

note: i have a function created to change a string to a integer value
note: my include statemaents for the whole project are as follows:
include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <string>
#include <time.h>
#include <conio.h>
#include <stdlib.h>
#include <windows.h>
#include <fstream>
#include <string.h>

a lot, i know xD

void DiskFileIO()
{
	cout << "do you want to save, or load?\n";
	cout << "1)save \n";
	cout << "2)load\n";
	cin >> intChoice;
	string strfilename;
	strfilename = strName + ".sav";
	

	if(intChoice == 1)
	{

		cout << "your file name is: " << strfilename << endl;
		cout << "saving....\n";



		ofstream outf(strfilename.data());

		outf << intAttack << endl;	//character attack
		outf << intDefence  << endl;//defence of the character
		outf << intMaxHealth << endl;	//the maxmimum health
		outf << intHealth << endl;  //current health
		outf << intMaxSP << endl;//the maximum SP	
		outf << intSP << endl;//the current SP
		outf << intLevel << endl;//the current character level
		outf << intExp << endl;//for determining the level
		outf << intExpNext << endl;//experience needed for the characters next level
		outf << intCurrCash << endl;//the current amount of money your character holds
		outf << dblSpellDmg << endl;//innitializes how much damage the spell is going to do
		outf << intInventory[0] << endl;
		outf << intInventory[1] << endl;
		outf << intInventory[2] << endl;
		outf << …
jonathanYoung 0 Newbie Poster

i need to make the variable "filename"(a character array of your name) and the string ".sav" into a one whole character array, so that i can use it with the older versions on c++, since the older versions don't completely support strings.

however, what you previously said seems to work with my current 2010 version, so i can only hope that it will work with the visual studio 6.0 version the school has....
thanks a lot, you're a life saver....and you just proved my teacher is a idiot xD

jonathanYoung 0 Newbie Poster

im using a different, most recent version of visual studio on my home desktop... but as far as i remember, the school version does

jonathanYoung 0 Newbie Poster

problem;
im currently in highschool, and the school uses an older version of visualc++ that does not support strings with all of the functions. the function im talking about is the one when you try to "open" a file to write onto it.
what i need to do is find a way to convert "strfilename = strName + ".sav";" into a character array capable of useing the function "ofstream outf(strfilename);"

note: when i change strName and strfilename into a character array, i get an error about two pointers not able to join together.

anyone have any advice??

P.S. sorry if this post does not make much sense, i'm trying my hardest to explain the situation

jonathanYoung 0 Newbie Poster

ouch that hurts my eyes. WHY aren't you using loops ?

do
{
    for(int i = 0; i < 15; i++){
            cout<<"|";
          for(int j = 0; j < 15; j++){
               cout<<intmap[i][j];
             }
           cout<<"|";
         }

   //rest of you code for input
}while(true)

Your teacher would fail you if she had seen that. make change ASAP.

ohhhhh snap
i did not even think of it
and my teachers retarded cause he couldn't help me with this either... all he does is sit in class and play video games baha...
thanks for your help : ]

jonathanYoung 0 Newbie Poster

hello;
i've been programming with c++ for about 2 months, BRAND new at this, im currently making a text based RPG for one of my programming classes. im having trouble with a error that comes up, and no one in my class can find out what exactly is the problem...
what exactly this code is doing: it is making a 15X15 map on the screen, with an "X" for where your current position is.
error:
o:\ics3u1\cpp\tasks_jonathanyoung\textbaserpg\main.cpp(192): error C2143: syntax error : missing ';' before ']'

NOTE: this error occurs from lines 184 to 198.
NOTE: this is only one function of about 25.... i didnt want to post the whole code so not all includes may be needed.

#define UP_ARROW    72
#define LEFT_ARROW  75
#define DOWN_ARROW  80
#define RIGHT_ARROW 77

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <string>
#include <time.h>
#include <conio.h>

using namespace std;

void mapcreate()
{
	bool boolmapon = true;

	char intmap[15][15];
	int intCharX = 7;
	int intCharY = 7;
	char KeyStroke;

	while(boolmapon == true)
	{

		for(;;)
		{
			intmap[intCharX][intCharY] = 'X'; 

			cout << "|--------------------------------------|\n";
			cout << "|" << intmap[0][0] << intmap[0][1] << intmap[0][2] << intmap[0][3] << intmap[0][4] << intmap[0][5] << intmap[0][6] << intmap[0][7] << intmap[0][8]] << intmap[0][9] << intmap[0][10] << intmap[0][11] << intmap[0][12] << intmap[0][13] << intmap[0][14] << "|" << endl;
			cout << "|" << intmap[1][0] << intmap[1][1] << intmap[1][2] << intmap[1][3] << intmap[1][4] << intmap[1][5] << intmap[1][6] << intmap[1][7] << intmap[1][8]] << intmap[1][9] << intmap[1][10] << intmap[1][11] << …