Random char's when using serial.println

I’m reading data from a file online .txt and it repeativiely reads the data with a 10 second delay and I keep getting random char’s on the end of the string:


Also if I change inString[16] to inString[4] the random numbers don’t seem to occur.

Here’s my code:

#include <SPI.h>
#include <WiFi.h>

char ssid[] = "NETGEAR62";      //  your network SSID (name)
char pass[] = "joyouslightning211";   // your network password
int keyIndex = 0;            // your network key Index number (needed only for WEP)
boolean startRead = false; // is reading?
int status = WL_IDLE_STATUS;

// Initialize the Wifi client library
WiFiClient client;

// server address:
char server[] = "www.krayis.com";
//IPAddress server(64,131,82,241);

unsigned long lastConnectionTime = 0;            // last time you connected to the server, in milliseconds
const unsigned long postingInterval = 10L * 1000L; // delay between updates, in milliseconds

void setup() {
  //Initialize serial and wait for port to open:
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);

  String fv = WiFi.firmwareVersion();
  if ( fv != "1.1.0" )
    Serial.println("Please upgrade the firmware");

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
  // you're connected now, so print out the status:

void loop() {
  // if there's incoming data from the net connection.
  // send it out the serial port.  This is for debugging
  // purposes only:

  char inString[16]; // string for incoming serial data
  int stringPos = 0; // string index counter
  while (client.available()) {
      char c = client.read();

      if (c == '<' ) { //'<' is our begining character
        startRead = true; //Ready to start reading the part 
      } else if(startRead) {
        if (c != '>'){ //'>' is our ending character
          inString[stringPos] = c;
          stringPos ++;
        } else {
          //got what we need here! We can disconnect now
          startRead = false;


  // if ten seconds have passed since your last connection,
  // then connect again and send data:
  if (millis() - lastConnectionTime > postingInterval) {


// this method makes a HTTP connection to the server:
void httpRequest() {
  // close any connection before send a new request.
  // This will free the socket on the WiFi shield

  // if there's a successful connection:
  if (client.connect(server, 80)) {
    // send the HTTP PUT request:
    client.println("GET /latest.txt HTTP/1.1");
    client.println("Host: Krayis");
    client.println("User-Agent: ArduinoWiFi/1.1");
    client.println("Connection: close");

    // note the time that the connection was made:
    lastConnectionTime = millis();
  else {
    // if you couldn't make a connection:
    Serial.println("connection failed");

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");

  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(" dBm");

moderator edit: code tags. Again

The Serial.print() method that takes a char array expects a string. Your char array is not a string. Google to find the difference. I'm tired of pointing it out. A string is such a basic C thing that anyone trying to do client/server communications should understand it like the back of their hand.