• C coding, adding two numbers and getting the average.
    47 replies, posted
[QUOTE=PvtCupcakes;16961251]Yeah I know system() works on Linux, but pause isn't a valid Linux/Unix/bash command.[/QUOTE] I know it isn't part of bash or any GNU tools, but you could still have gotten a pause program from a third party source.
[QUOTE=jA_cOp;16961336]I know it isn't part of bash or any GNU tools, but you could still have gotten a pause program from a third party source.[/QUOTE] Wait. So instead of doing something with the input from YOUR program (or better yet, just running it from the command line like you're supposed to), you're going to rely on the user to get some 3rd party "pause" program?
[QUOTE=nullsquared;16962243]Wait. So instead of doing something with the input from YOUR program (or better yet, just running it from the command line like you're supposed to), you're going to rely on the user to get some 3rd party "pause" program?[/QUOTE] Try reading the thread. Did you even read the post you just quoted?
[QUOTE=zotic;16960882]Guys i got it to work, now our whole class is going to C# >_>'[/QUOTE] This thread is not about you anymore, as you can see they got distracted with meaningless stuff yet again.
Yup.. Did that in my thread as well.. Btw: (a + b)/2 (a+b+c+d+e+f)/6 RAWRAWRAWRAWRARAWR
[QUOTE=Sporbie;16963732]This thread is not about you anymore, as you can see they got distracted with meaningless stuff yet again.[/QUOTE] Figures :v:
[QUOTE=jA_cOp;16963596]Try reading the thread. Did you even read the post you just quoted?[/QUOTE] Actually no matter how many times I read that post it seems to me like he was implying that the user must manually install a third party program to handle the fact that the program makes the shell run "pause". :v:
[QUOTE=nos217;16965200]Actually no matter how many times I read that post it seems to me like he was implying that the user must manually install a third party program to handle the fact that the program makes the shell run "pause". :v:[/QUOTE] This is how I saw it too. "Yeah there's no default pause program but you can just install a 3rd party one and then use system("pause") instead"
Well you can, it's stupid, but you can.
[QUOTE=nos217;16965200]Actually no matter how many times I read that post it seems to me like he was implying that the user must manually install a third party program to handle the fact that the program makes the shell run "pause". :v:[/QUOTE] [QUOTE=nullsquared;16966037]This is how I saw it too. "Yeah there's no default pause program but you can just install a 3rd party one and then use system("pause") instead"[/QUOTE] You should have read the thread then... I was referring to _Kilburn saying it worked on Linux, and you can't really dispute that, because the system function works on Linux, so it might've worked on Linux for him when he tried if he had gotten a pause program from somewhere. edit: I'm hardly one to advocate the system function: [QUOTE=jA_cOp;16339720]Writing for a specific OS isn't inherently bad, sometimes your program is only useful on one OS or one family of OSs, other times it could rely on an OS specific feature. The system function isn't a "bad" function, but it spawns some bad coding patterns, like using system("pause") to pause execution. system("pause") uses relatively lots of resources to open a new process (namely the "pause" command), then it waits for this process to end before it continues. Both the C and C++ standard libraries (and underlying API's, like the Windows API) offers ways of waiting for input before continuing execution without forking a new process, and thus uses much less resources and CPU time to do this. Since performance generally isn't an issue when you're waiting for a keypress; you end up with the fact that using the standard library your code doesn't rely on an environment specific feature. Using the system function also means that it will silently fail; if using system("pause") is the only reason your program doesn't work on the users environment, it will still compile just fine, but when you run it, the system function suddenly returns immediately instead of waiting! Proper use of the system function include checking its return value to see if it succeeded, but then there's no point because the getchar and cin.get functions don't require this and are guaranteed to work.[/QUOTE]
System() is one of those POSIX things that kind of require an entire operating system behind it. You'd be surprised with the amount of code that is run without any advanced operating system behind it. system("pause") would probably not run on any of the game consoles.
[QUOTE=Cathbadh;16975619]System() is one of those POSIX things that kind of require an entire operating system behind it. You'd be surprised with the amount of code that is run without any advanced operating system behind it. system("pause") would probably not run on any of the game consoles.[/QUOTE] system function (always) silently fails for the Nintendo DS with devkitARM :)
This section should just be called argue about system pause.
[QUOTE=Cathbadh;16975619]System() is one of those POSIX things that kind of require an entire operating system behind it. You'd be surprised with the amount of code that is run without any advanced operating system behind it. system("pause") would probably not run on any of the game consoles.[/QUOTE] Then POSIX_ME_HARDER, boy.
[QUOTE=Pj The Dj;16975656]This section should just be called argue about system pause.[/QUOTE] More like "Discuss programming issues then everybody gets their panties in a twist because arguing is immoral or something".
No it's just annoying when the thread changes subject to some ridiculous argument.
[QUOTE=nos217;16997787]No it's just annoying when the thread changes subject to some ridiculous argument.[/QUOTE] We solved his problem long ago, what's so annoying about it?
Oh right. I'm dumb, I thought this guy still wanted his problem worked out.
Sorry, you need to Log In to post a reply to this thread.