He's also a student trying to get us to help him with his homework. The fact he's not putting forth the effort to even make us understand what the problem is suggests he may not even be putting forth the effort to do the work himself. In which case, name-calling might slap him awake long enough to realize he's a newbie and motivate him to strive to get to the level of the supposed experts.
If you think my statement is offensive even though I qualified it with "at least until you provide proof that it does not work for you" and explained what is required (for a second time considering Salem had already explained it), then use the report post button to report my post.He's new, and a beginner. I agree he could be more helpful, but name-calling is bad forum etiquette, and not helpful, either.
Until then, let's wait for a reply by behzad_shabani that hopefully has further explanation and a sufficient code example.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
In a small and simple code it worked! but when I put it in my original code it doesn't work!
I don't know where is my fault!
One approach if you really do not know where is the problem is to rewrite your code based on the small and simple code that you know works. Code incrementally, so when you add a few lines and suddenly the code stops working, you know the problem is likely in those lines that you added (or perhaps it is elsewhere, but came to light when those lines were added).In a small and simple code it worked! but when I put it in my original code it doesn't work!
I don't know where is my fault!
Of course, if all else fails, then you simply have to provide the original code, but the problem with that is that if it is too big a sample, nobody will read it and thus nobody will help you (unless they happen to be very bored).
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
If I wast off your time you can report this thread to moderator to close! or report me to ban!
I just ASK for help, I'm not forcing you to help!
Don't forget someday you was just like me!
If you want help, post your code so we can figure out what you're doing wrong. If you can't understand this, then you're not going to get any help.
I think I could solve the problem!
thank you laserlight, Salem and other who helps me!
gets, fgets, scanf, sscanf, and other stream reading function SUCKS
I wrote a function by MYSELF:
Code:/*****getstr(): getting an stream*****/ // WRITTEN BY: Behzad Shabani // CALLING FUNCTION: getstr(stream); void getstr(char* stream){ /* function variables */ int i, flag = 0; char ch; /* function process*/ for (i = 0; flag == 0; i++){ ch = getche(); if (ch == '\r'){ if (i != 0){ stream[i] = '\0'; flag = 1; continue; } else { printf("\a"); i--; continue; } } else if (ch == '\b'){ printf("\b"); i--; continue; } stream[i] = ch; } }
What sucks is your use of non-portable functions from conio.h (which is obsolete).
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Awesome. A garbage version of gets(). Oh, I can't wait to use this in my next virus.
Eh, do you realise that your functions sucks even more than gets(), which sucks really badly? The problem with gets() is that the length of the string is not specified, so it is vulnerable to a buffer overrun.Originally Posted by behzad_shabani
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)