Read it into what? the char* ? So how can i get what i read from there? i'm sorry, but i'm not an ace on C++, i would like to learn, for example, if i use this, is it valid? :
struct scanner {
scanner(){};
int INT;
int nextInt(){
fread(&INT,sizeof(int),1,stdin);
return INT;
}
};
int main () {
scanner sc;
int a = sc.nextInt();
printf("%d\n",a);
}
why doesn't int work? as far as i understand, fread locates the number of bytes (sizeof(int)) in INT (its only one element) from stdin, what i am doing wrong? thanks.