M
Markus Dehmann
The following if condition
if((stream = fmemopen((void*)str, strlen(str), "r")) == NULL){
// ...
}
gives me a warning: assignment makes pointer from integer without a
cast
But only when I compile it with gcc. With g++ it's fine. Why does the
warning show up and how can I get rid of it (using gcc)?
I tried it with gcc 3.2.2 and 3.3.1 and got the same warnings both
times.
Thanks!
Markus
PS: Here is a mini version of a program I am trying
#include <stdio.h>
#include <string.h>
int main(){
char ch;
FILE *stream;
char *str = "test";
if((stream = fmemopen((void*)str, strlen(str), "r")) == NULL){
fprintf(stderr, "Cannot open stream to string '%s'\n", str);
}
while ((ch = fgetc (stream)) != EOF)
printf ("Got %c\n", ch);
fclose (stream);
return 0;
}
if((stream = fmemopen((void*)str, strlen(str), "r")) == NULL){
// ...
}
gives me a warning: assignment makes pointer from integer without a
cast
But only when I compile it with gcc. With g++ it's fine. Why does the
warning show up and how can I get rid of it (using gcc)?
I tried it with gcc 3.2.2 and 3.3.1 and got the same warnings both
times.
Thanks!
Markus
PS: Here is a mini version of a program I am trying
#include <stdio.h>
#include <string.h>
int main(){
char ch;
FILE *stream;
char *str = "test";
if((stream = fmemopen((void*)str, strlen(str), "r")) == NULL){
fprintf(stderr, "Cannot open stream to string '%s'\n", str);
}
while ((ch = fgetc (stream)) != EOF)
printf ("Got %c\n", ch);
fclose (stream);
return 0;
}