Not trying to insult anyone, I dont know any C and i'm getting rude remarks about my bad code, i'm not trying to write a magnificent program just need something that works thats all.
I do listen...
Type: Posts; User: mrbump2004
Not trying to insult anyone, I dont know any C and i'm getting rude remarks about my bad code, i'm not trying to write a magnificent program just need something that works thats all.
I do listen...
Hi
I've done fgets and store it but the thing is i dont want the newline it automatically stores. Any idea how to remove it? or not get it in the first place?
Thanks
Still has Segmentation Fault even with changes you have suggested. I had this problem and fixed it by entering the sizes of my strings i've made some changes and its back, thing is this code does...
I dont see anything different, if anything this code is easier than it was
char str1[1000] = "";
char str2[1] = "^";
char str4[1001] = "";
printf("Enter : ");
My bad code works fine now with a do while loop, my research skills are fine hence the do while loop thanks anyway
fflush(stdin); doesn't work on linux though apparently, i just changed the earlier fscanf i had into fgets but that simply skipped too, with no way to clear the input stream in linux surely there...
http://www.cygwin.com/ml/cygwin/1998-12/msg00108.html
This is the same problem, but has no replies.
I can't get a small example to work. Literally though thats all there is. Everything else is below. I start the prog and it comes to that menu. I enter a number and it goes to the part i'm having...
Sorry its huge and i mean huge and its a bit sensitive. It all works apart from this one bit but it did stop for inout when using scanf, i've added a little more
printf("MENU\n");...
Should probably mention that this is on linux?
I posted it as reply then decided it needed its own thread, someone had replied by then though, sorry
Chill it was an accident, i posted it then removed it and created another thread
Thats it below, just doesn't pause for input??
char str1[50] = "";
char str2[] = "^";
printf("Enter : ");
fgets (str1, sizeof str1, stdin);
Ta, did that but it doesn't pause for an input just streams straight past it??
So how do I take input from a keyboard for a whole line
Yep someone else told me that too, and it works cheers, but the problem now is
that scanf ("%s",str1);
only returns the first word of whatever i type. If i add "Hello my name is Jon"
and...
Thanks it gets rid of the segmentation fault, however if i type any number of words, like
"Hello my name is Jon" it only take the word hello, am i using the wrong thing fgets?
thanks for that. i created another thread for it, sorry :D
I'm getting an error when running.
Segmentation Fault for this bit of code?
char str1[] = "";
char str2[] = "^";
char str3[] = "";
printf("Enter: ");
scanf ("%s",str1);
There you go, knew it would be easy for someone, thanks a lot
ok so I have a program its main function is
int main(int argc, char *argv[])
its the only function and when it gets to the bottom it closes. However I want it to go back to the top again. I...