Well Im making a console based app with a bunch of tools for me to use, and right before I started getting it to check the commands I noticed it's treating string diffrently then I expected. If I type in "BLAH" it echos back "<<: !BLAH" as expected, but if I do "BLAH DUR" it echos back "<<: !BLAH <<: <<: !DUR". Instead of "<<:!BLAH DUR". It seems like its spliting automaticly where there is a space. Be warned, im not the best coder. Here's the code.
main.cpp
Code:
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include "textf.h"
#include "main.h"
using namespace std;
TEXTFUNC btext;
int main()
{
btext.init();
return 0;
}
textf.cpp
Code:
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
#include "textf.h"
using namespace std;
void TEXTFUNC::init()
{
//Assign <<: to harrow before its used
harrow = "<<: ";
startup();
}
void TEXTFUNC::startup()
{
system ("cls");
ban("Blade Tools By: Jonathan Bastnagel");
getinput();
}
void TEXTFUNC::getinput()
{
string inputchar;
ba("");
cin>>inputchar;
exec(inputchar);
}
void TEXTFUNC::exec(string execstring)
{
ban("!" + execstring);
//ban("Exec" + execstring.c_str());
getinput();
}
void TEXTFUNC::ban(std::string textstring)
{
cout<<harrow<<textstring<<"\n";
}
void TEXTFUNC::bn(std::string textstring)
{
cout<<textstring<<"\n";
}
void TEXTFUNC::ba(std::string textstring)
{
cout<<harrow<<textstring;
}
void TEXTFUNC::b(std::string textstring)
{
cout<<textstring;
}
main.h
Code:
#ifndef MAIN_H
#define MAIN_H
class MAIN
{
public:
};
#endif
textf.h
Code:
#ifndef TEXTF_H
#define TEXTF_H
class TEXTFUNC
{
public:
//Assigns default values to variables
void init();
//Starts up, shows about info
void startup();
//Grabs keyboard input, send's to exec to be checked, and executed
void getinput();
//Checks inputed characters, and does required functions
void exec(std::string execstring);
//Outputs text with <<: and new line
void ban(std::string textstring);
//Outputs text with <<:
void ba(std::string textstring);
//Outputs text with new line
void bn(std::string textstring);
//Outputs text
void b(std::string textstring);
private:
//<<: Arrow string
std::string harrow;
};
#endif
EDIT: I just noticed I accidently put it in C Programming instead of C++ Programming