Stop Microsoft

Miscellaneous => Programming & Networking => Topic started by: Kintaro on 13 November 2002, 13:51

Title: Fucking Confusing++
Post 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
Code: [Select]
Title: Fucking Confusing++
Post by: flap on 13 November 2002, 16:50
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)
Title: Fucking Confusing++
Post by: The Auditor on 13 November 2002, 18:47
I found the problem..
" Microsoft Dos XP Source Code"

I think that sums it up.. LOL

... Sorry.

The Auditor
Title: Fucking Confusing++
Post by: Kintaro on 14 November 2002, 13:43
lol, it will be just another work of art when im finished.
Title: Fucking Confusing++
Post by: Kintaro on 14 November 2002, 13:51
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!
Title: Fucking Confusing++
Post by: Kintaro on 14 November 2002, 13:53
Here is the source, luke  :D

Code: [Select]
Title: Fucking Confusing++
Post by: voidmain on 14 November 2002, 13:59
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.
Title: Fucking Confusing++
Post by: Kintaro on 14 November 2002, 14:17
Could you do me a favour and write a sample peice of code?
Title: Fucking Confusing++
Post by: voidmain on 15 November 2002, 02:27
Sure:

Code: [Select]
Title: Fucking Confusing++
Post by: Kintaro on 15 November 2002, 08:37
Thanks!

Why do old people hate ebject oreiented programming?
Title: Fucking Confusing++
Post by: voidmain on 15 November 2002, 21:37
For the same reason that young people think they know everything.  (http://smile.gif)
Title: Fucking Confusing++
Post by: Stryker on 15 November 2002, 21:44
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 ]

Title: Fucking Confusing++
Post by: The Auditor on 15 November 2002, 21:48
I don't think i know everything, i KNOW i know everything..
ROFL

The Auditor

Sorry.. it needed to be said.
Title: Fucking Confusing++
Post by: voidmain on 15 November 2002, 21:59
I'm not young enough yet to know *everything*.
Title: Fucking Confusing++
Post by: Kintaro on 15 November 2002, 10:09
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.
Title: Fucking Confusing++
Post by: Kintaro on 2 December 2002, 11:52
Anyone have ideas or functions for my Dos XP Project?
Title: Fucking Confusing++
Post by: Doogee on 2 December 2002, 12:32
no
Title: Fucking Confusing++
Post by: Chooco on 2 December 2002, 14:08
Code: [Select]
then it has this
Code: [Select]

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 ]

Title: Fucking Confusing++
Post by: Kintaro on 2 December 2002, 14:38
Uhm get the very last source addition, it was fixed.
Title: Fucking Confusing++
Post by: hm_murdock on 4 December 2002, 01:14
X11, make a graphics DOSSHELL.net that looks like the old dos shell but with xp graphics!
Title: Fucking Confusing++
Post by: Kintaro on 4 December 2002, 11:59
quote:
Originally posted by Chooco:
Code: [Select]
then it has this
Code: [Select]

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]


Code: [Select]
Doesnt look that way dude.
Title: Fucking Confusing++
Post by: rparsi on 28 December 2002, 20:59
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
Code: [Select]
[/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;}'
}
Title: Fucking Confusing++
Post by: beltorak0 on 29 December 2002, 04:24
Code: [Select]
<hr></blockquote>

What if you need to validate data?
Code: [Select]
watch out for endless loops.

this might make my reasoning a little clearer:
Code: [Select]
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 ]