S
sushi boi
hi,
ive noticed some weird behavior with OSx's scanf. For some reason
subsequent scanf statements stops working in osx if you press ctrl
+d(eof). to see what i'm on about.. combile and run this.. the print
statements tell u what to expect and what to do:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define STR_LENGTH 25
int main(){
char str1[STR_LENGTH];
char str2[STR_LENGTH];
int num;
char err[STR_LENGTH];
printf("type any string: ");
scanf("%s",str1);
printf("type any number: ");
scanf("%d",&num);
printf("fName... press EOF: ");
scanf("%s",fName);
printf("expecting a string... Type EOF(ctrl+d).. : ");
scanf("%s",str2);
printf("\nmeant to ask for more input: \n");
scanf("%s",err);
printf("see what i mean!\n");
return (0);
}
ive noticed some weird behavior with OSx's scanf. For some reason
subsequent scanf statements stops working in osx if you press ctrl
+d(eof). to see what i'm on about.. combile and run this.. the print
statements tell u what to expect and what to do:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define STR_LENGTH 25
int main(){
char str1[STR_LENGTH];
char str2[STR_LENGTH];
int num;
char err[STR_LENGTH];
printf("type any string: ");
scanf("%s",str1);
printf("type any number: ");
scanf("%d",&num);
printf("fName... press EOF: ");
scanf("%s",fName);
printf("expecting a string... Type EOF(ctrl+d).. : ");
scanf("%s",str2);
printf("\nmeant to ask for more input: \n");
scanf("%s",err);
printf("see what i mean!\n");
return (0);
}