I am trying to read from file. After reading, I want to display it's contents. My program looks like :
#include <stdio.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char const *argv[])
{
//
char array_of_input[10][10];
FILE *fp;
fp = fopen("input.txt","r+");
int i = 0,j = 0;
char ch;
while ( !feof(fp))
{
ch = (char)fgetc(fp);
printf("%c\n", ch );
if ( ch == " ")
{
continue;
}
else if ( ch == "\n")
{
i++ ;
j = 0 ;
}
else
{
array_of_input[i][j] = ch;
j++;
}
}
return 0;
}
But, I am getting error:
ISO C++ forbids comparison between pointer and integer [-fpermissive] if ( ch == " ")
fgetc(fp)
returns int and then it's type-cast to char
. I can't see any integer here.