comparison against char c = messes things up?

I am trying to get characters from a webpage into a 2D char array. If I do just that it works, but I want to filter out certain characters from getting into the array.

I have tried:
(if c != ‘h’)
array[index]= c;

But the comparison seems to mess things up.
This worked when my sketch was based on building Strings, but I am trying to conserve memory, and the same technique seems to mess things up, although I don’t understand why.

In the code below I have the comparison commented out on line 47.
Any help is much appreciated.

#include <Bridge.h>
#include <YunClient.h>
#include "Client.h"

String baseUrl = "";
static const int num = 10;
static const int len = 70;
char temps[num][len];

YunClient client;

void setup() {

void loop() {


void call(Client& inclient){
 int a = 0; int x = 0;
  if (inclient.connect(baseUrl.c_str(), 80)){   
    inclient.print(F("GET "));  
  }else {
    Serial.println("connection failed");
    while(inclient.available()) {
    char c =; 
    if(x > len-2)
    temps[a][x] = '\0'; 
    x = 0;
    if(a < num){
      else{ Serial.println("\nlimit reached"); break; }    

      //if(c != 'h') ////////////////////////////////<<<why doesn't this work?
      temps[a][x] = c; 
      if(x < len)
      temps[a][x] = '\0'; 
      for(int i = 0; i < num; i++)


What ends up happening? It looks like you might be missing curly braces around that if block.

That's not the right syntax... Try

if( c != 'h'){
  array[index]= c;

I tried it with and without curly braces but it makes no difference.
( I thought you could put a single line directly under an if statement without braces in c++?)

With the comparison in there (which is just supposed to remove ‘h’) it outputs:

<!DOCTYPE HTML File <meta l;c file.


With it commented out it outputs:

Test HTML File

This is a very simple HTML file.

oraz: ( I thought you could put a single line directly under an if statement without braces in c++?)

You can, but you cannot do: (if c != 'h'), that doesn't make sens.

And I think I have a ahhhhhh. You don't put it into the array but you DO increment the counter don't you? So you end up with a empty entry which terminates the print ;) So only increment the index when you do put something into the array.

Because of the missing braces after testing the character, x will be incremented for each character read not for each character put in the array, which I assume is the intention.

Yes!! You got it septillion (first at least) :) I'm glad you spotted it. And that it is easy to fix! Working now..