Learning C++/lua
#6
thanks,

i'm now trying to make a configuration file just like with my build script but than in c++ just to practise.
i'm now struggeling that i can't put letters in a variable. with the server description part if i now put letters in it, it says 0 in the settings.ini.
if you want to look in the "source" this is it:
Code:
#include <iostream>
#include <fstream>
using namespace std;

//the remove part
int Remove()
{
  if( remove( "Settings.ini" ) != 0 )
    perror( "Error deleting file" );
  else
    puts( "File successfully deleted" );
  return 0;
}

//the server configuration
int main()
{
int Port;
  int MaxPlayers;
  int Description;

    cout << "Please Enter your server port (default minecraft is 25565): ";

    cin >> Port;

    cout << "Please enter the maxplayers able to join: ";

    cin >> MaxPlayers;

    cout << "Please enter your server description: ";

    cin >> Description;
  ofstream myfile;
  myfile.open ("settings.ini");
  myfile << "[Server]\n" << "port=" << Port << "\nmaxplayers=" << MaxPlayers << "\nDescription=" << Description;
  myfile.close();
  return 0;
}
Reply
Thanks given by: PCPlayerLV


Messages In This Thread
Learning C++/lua - by NiLSPACE - 12-04-2012, 03:50 AM
RE: Learning C++ - by FakeTruth - 12-04-2012, 05:17 AM
RE: Learning C++ - by NiLSPACE - 12-04-2012, 07:06 AM
RE: Learning C++ - by FakeTruth - 12-04-2012, 08:53 AM
RE: Learning C++ - by xoft - 12-05-2012, 12:22 AM
RE: Learning C++ - by NiLSPACE - 12-10-2012, 04:34 AM
RE: Learning C++ - by FakeTruth - 12-10-2012, 08:34 AM
RE: Learning C++ - by NiLSPACE - 12-10-2012, 11:20 PM
RE: Learning C++ - by xoft - 12-10-2012, 11:58 PM
RE: Learning C++ - by NiLSPACE - 12-11-2012, 01:35 AM
RE: Learning C++ - by NiLSPACE - 12-12-2012, 06:19 AM
RE: Learning C++ - by xoft - 12-12-2012, 07:39 PM
RE: Learning C++ - by NiLSPACE - 12-12-2012, 10:08 PM
RE: Learning C++ - by FakeTruth - 12-12-2012, 09:32 PM
RE: Learning C++ - by NiLSPACE - 01-22-2013, 03:05 AM
RE: Learning C++ - by FakeTruth - 01-22-2013, 09:54 AM
RE: Learning C++ - by NiLSPACE - 01-22-2013, 06:03 AM
RE: Learning C++ - by bearbin - 01-22-2013, 06:42 AM
RE: Learning C++ - by NiLSPACE - 01-22-2013, 07:32 AM
RE: Learning C++ - by NiLSPACE - 01-23-2013, 04:35 AM
RE: Learning C++ - by FakeTruth - 01-23-2013, 07:10 AM
RE: Learning C++ - by NiLSPACE - 01-23-2013, 07:33 AM
RE: Learning C++ - by FakeTruth - 01-23-2013, 08:00 AM
RE: Learning C++ - by xoft - 01-23-2013, 11:39 AM
RE: Learning C++ - by FakeTruth - 01-24-2013, 12:54 AM
RE: Learning C++ - by bearbin - 01-25-2013, 04:28 AM
RE: Learning C++ - by xoft - 01-25-2013, 10:23 AM
RE: Learning C++/lua - by NiLSPACE - 02-11-2013, 05:32 AM
RE: Learning C++/lua - by NiLSPACE - 10-07-2013, 04:51 AM
RE: Learning C++/lua - by xoft - 10-07-2013, 06:09 AM
RE: Learning C++/lua - by tigerw - 10-10-2013, 03:17 AM
RE: Learning C++/lua - by NiLSPACE - 10-10-2013, 03:20 AM



Users browsing this thread: 13 Guest(s)