Simplify and make work without warnings

This commit is contained in:
sam-astro 2022-08-28 12:43:01 -04:00
parent eda78e8c39
commit d7c79c6601
2 changed files with 17 additions and 4 deletions

View File

@ -1,6 +1,14 @@
#ifndef BUILTIN_H #ifndef BUILTIN_H
#define BUILTIN_H #define BUILTIN_H
#if defined(__unix__)
#define UNIX true
#define WINDOWS false
#elif defined(_MSC_VER)
#define UNIX false
#define WINDOWS true
#endif
#include <iostream> #include <iostream>
#include <fstream> #include <fstream>
#include <string> #include <string>
@ -470,10 +478,10 @@ boost::any ZSFunction(const string& name, const vector<boost::any>& args)
} }
else if (name == "ZS.System.Command"){ else if (name == "ZS.System.Command"){
string command = StringRaw(AnyAsString(args.at(0))); string command = StringRaw(AnyAsString(args.at(0)));
int command_len = command.length(); //int command_len = command.length();
char command_char_arr[command_len + 1]; //char* command_char_arr=new char[command_len + 1];
strcpy(command_char_arr, command.c_str()); // string into char arr //strcpy(command_char_arr, command.c_str()); // string into char arr
int k = system(command_char_arr); int k = system(command.c_str());
} }
else else
LogWarning("ZS function \'" + name + "\' does not exist."); LogWarning("ZS function \'" + name + "\' does not exist.");

View File

@ -0,0 +1,5 @@
func Main()
{
Printl("this is a test:")
ZS.System.Command("cls")
}