I want to read a character and store it into the char[]
array and here is my method called getaline
public static int getaline(char message[], int maxlength)
{
int index = 0;
while (message[index] != '\n')
{
message[index] = fgetc(System.out);
index++;
}
index++;
}
and my fgetc
method:
public static int fgetc(InputStream stream)
and this method should returns a character from the input stream.
But i keep getting an error message when i compile:
error: possible loss of precision
message[index] = fgetc(System.in);
^
required: char
found: int
what should i put inside fgetc
so that i can collect input from the user??