Oh joy, InSim and C++. You know I bother people so much that they should program in C++, but when it comes to me doing it. Well these are the results. This is about 45 minutes in and not even 45 lines of code have been made. I have some major fundimental problems I need to overcome before I can really start programing this thing. This compiles and works, to a point, but it does not even connect to InSim thanks to the hole struct malarkey that I have to endure.
When I try to do something like
ISI.Id = "ISI"; // or
SI.Id = 'ISI';
for that matter anything with the double quotation marks, I get an error. Did I miss something in the fundiments of C++ that stings that are char arrays can't have the double quotes thing around them? And here's another thing that bothers the crap out of me.
ISI.Admin = argv[1];
Why does that not work? "incompatible types in assignment of `char*' to `char[16]'" That's ridiculous. Its a freaking char, what does it matter if its 16 or 1600 charters long. I think I have done to much work in PHP, its been pampering me to much. It's just that is so god damn convoluted to get any work done in here.
<?php
#include <stdio.h>
struct InSimInit // UDP packet to initialise the InSim system
{
char Id [4]; // ISI + zero
unsigned short Port; // Port for UDP replies from LFS (0...65535)
unsigned short Flags; // Bit flags for options - see below
unsigned short NodeSecs; // Number of seconds between NLP or MCI packets (0=none)
char Admin[16]; // Admin password (required if set in LFS host options)
};
int main ( int argc, char *argv[] )
{
if ( argc != 2 )
printf("usage: %s <PORT> <PASSWORD>\n", argv[0]);
else
{
InSimInit ISI;
ISI.Id[0] = 'I';
ISI.Id[1] = 'S';
ISI.Id[2] = 'I';
ISI.Port = 65000;
ISI.Flags= 16;
ISI.Admin[0] = 'A';
ISI.Admin[1] = 'S';
ISI.Admin[2] = 'D';
ISI.Admin[3] = 'F';
printf("ID : %s\n", ISI.Id);
printf("PA : %s\n", ISI.Admin);
}
return 0;
}
?>
ISI.Id = "ISI"; // or
SI.Id = 'ISI';
for that matter anything with the double quotation marks, I get an error. Did I miss something in the fundiments of C++ that stings that are char arrays can't have the double quotes thing around them? And here's another thing that bothers the crap out of me.
ISI.Admin = argv[1];
Why does that not work? "incompatible types in assignment of `char*' to `char[16]'" That's ridiculous. Its a freaking char, what does it matter if its 16 or 1600 charters long. I think I have done to much work in PHP, its been pampering me to much. It's just that is so god damn convoluted to get any work done in here.