Stop Microsoft
Miscellaneous => Programming & Networking => Topic started by: Kintaro on 13 November 2002, 13:51
-
I cant get this program to work, i commented on the source more then enough so you should understand it...
Main.cpp
-
if (cmdi == "exit")
cmdi is a pointer to a string, so its value will actually just be an address of location in memory. You need to use strcmp to compare the actual contents of the string with "exit":
if (strcmp(cmdi, "exit") == 0)
-
I found the problem..
" Microsoft Dos XP Source Code"
I think that sums it up.. LOL
... Sorry.
The Auditor
-
lol, it will be just another work of art when im finished.
-
Still just exits :( does anyone know why <x11 fiddles in vi>...
Im an idiot, sorry i had while exitlevel == 0 because im a complete freekin retard. (Its always a stupidity bug in my programs)
:D (Working (except for ver))
....
Ahhh got it... Nother stupidity problem (Gee Ex Eleven must have been really on the pills when posting that)...
Anyway how do you make everything in the cmdi string lower case after input
BASIC EQUIV:
cmdi$ = lcase$(cmdi$)
Thanks in advance!
-
Here is the source, luke :D
-
quote:
Originally posted by Ex Eleven / b0b 2.1:
Anyway how do you make everything in the cmdi string lower case after input
BASIC EQUIV:
cmdi$ = lcase$(cmdi$)
One way of doing it is to use the "tolower()" function. Mind you that this function will only change the case of a single character so you have to loop through your string.
-
Could you do me a favour and write a sample peice of code?
-
Sure:
-
Thanks!
Why do old people hate ebject oreiented programming?
-
For the same reason that young people think they know everything. (http://smile.gif)
-
why don't you change the while statement to have it be:
while (exitlevel==0) {
?
Otherwise it will always exit because it's set at 0 default, but if it isn't 1 then it won't go through the loop.
(EDIT)
nevermind, i see someone already got to it.
[ November 15, 2002: Message edited by: Stryker ]
-
I don't think i know everything, i KNOW i know everything..
ROFL
The Auditor
Sorry.. it needed to be said.
-
I'm not young enough yet to know *everything*.
-
quote:
Originally posted by Stryker:
why don't you change the while statement to have it be:
while (exitlevel==0) {
?
Otherwise it will always exit because it's set at 0 default, but if it isn't 1 then it won't go through the loop.
(EDIT)
nevermind, i see someone already got to it.
[ November 15, 2002: Message edited by: Stryker ]
Yea that was a "stupidity" bug that i accidentaly did... Im always slightly drunk... so i do a lot of that. But my perants apparently are going to put me in AA.
-
Anyone have ideas or functions for my Dos XP Project?
-
no
-
then it has this
you have it set so that while there is no exit level, it will set the error level to 1 then print "Bad Command or file name\n\n"
your program will forever be printing the error of "Bad Command or file name\n\n" because it's looped to do so....
or so i think.
[ December 02, 2002: Message edited by: Chooco ]
[ December 02, 2002: Message edited by: Chooco ]
-
Uhm get the very last source addition, it was fixed.
-
X11, make a graphics DOSSHELL.net that looks like the old dos shell but with xp graphics!
-
quote:
Originally posted by Chooco:
then it has this
you have it set so that while there is no exit level, it will set the error level to 1 then print "Bad Command or file name\n\n"
your program will forever be printing the error of "Bad Command or file name\n\n" because it's looped to do so....
or so i think.
[ December 02, 2002: Message edited by: Chooco ]
[ December 02, 2002: Message edited by: Chooco ][/b]
Doesnt look that way dude.
-
quote:
Originally posted by Ex Eleven / b0b 2.1:
I cant get this program to work, i commented on the source more then enough so you should understand it...
Main.cpp
[/b]
In general, it's NOT a good idea to use a conditional check variable to also store data. Here's an example of what I mean (reduces stupidity bugs which I make frequently):
int done=0;
int age=0;
while(!done)
{ age=calculateSomething();
done=(age>=26);//same thing as 'if(age>=26){ done=1;}'
}
-
<hr></blockquote>
What if you need to validate data?
watch out for endless loops.
this might make my reasoning a little clearer:
I just pulled that out of my ass, so don't expect it to compile.
throwing in another variable to track can be a pain.
-t.
[ December 28, 2002: Message edited by: beltorak0 ]