BOOL operators

This is a discussion on BOOL operators within the C++ Programming forums, part of the General Programming Boards category; Hey guys, I was just wondering if anyone could help me with BOOL operators. I was making a deletion program ...

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    13

    BOOL operators

    Hey guys, I was just wondering if anyone could help me with BOOL operators. I was making a deletion program that revails all hidden folders and deletes them. (If allowd by user) The thing is, I wanted it to say "All Clear" or something like that when all files other then the deletion program and its copies are gone. So lets say:

    C:\Folder\Myprogram.exe
    and
    C:\Folder\MyProgram2.exe

    are still there. Since they have the same code and strings they don't count as still being there when the message pops up. I know I should use these functions,:
    ShellExecute()
    ShellExecuteEX()
    _ASM()
    but I can't figure it out. Thanks for your time.

    Regards...

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Could you rephrase the problem? I'm having trouble understanding your goal at the moment. Post some code too.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    13
    Sorry, what I ment was, lets say two files are in a folder. They both make copies of themselves and try to destroy the other file. When all of the other file is deleted then it displays "File Wins" or something like that. The files have to stay in the same folder but can make sub-directories. I didn't realy know how to do this so I don't have code for this part, well thakns for your time.

  4. #4
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    They both make copies of themselves and try to destroy the other file.
    Why do they do this in the first place?

    When all of the other file is deleted then it displays "File Wins" or something like that.
    Is this some sort of game?

    The files have to stay in the same folder but can make sub-directories.
    What are the sub-directories for?

    I am getting the feeling that this is some sort of AI computer vs computer game where two 'files' battle it out for superiority. If so, it seems pretty pointless. Can you try to explain a bit more?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  5. #5
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Assuming that you are going to be working with files, and you use windows, here are some functions:

    #include <windows.h>

    CopyFile()
    CreateFile()
    DeleteFile()
    FindFirstFile()
    FindNextFile()
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  6. #6
    Registered User
    Join Date
    Oct 2003
    Posts
    13
    It's like two viruses made from two different ppl and try to survive, they have to keep the same name, like Killer.exe will have to stay Killer.exe, Vb.exe will have to stay Vb.exe, etc. So that's what the sub-directories are for. I know how to delete and copy and use techniques on the other one I just can't get it to know if all other files are deleted.

  7. #7
    Registered User
    Join Date
    Oct 2003
    Posts
    13
    Sorry to spam, I didn't know how long I should wait to bump but it has been two or three days.

  8. #8
    Spaced Cadet
    Join Date
    Aug 2003
    Posts
    110
    You should actually wait for the thread to move off of the first page, but considering the activity lately that should be fine. I can't quite recall cboard's policy.

  9. #9
    Registered User
    Join Date
    Oct 2003
    Posts
    13
    Originally posted by Dark Nemesis
    You should actually wait for the thread to move off of the first page, but considering the activity lately that should be fine. I can't quite recall cboard's policy.
    Yeah it was on the second page.

  10. #10
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I find it hard to imagine this sort of game, because I don't think I've ever seen anything like it.

    If this is going to involve a lot of file operations, you might want to think about simulating it instead, to improve performance. You could implement timers and mock directory listings to simulate what is happening.

    If I am correct, there are two main files right? The player is VB.exe, and the computer is virus.exe. Virus.exe attempts to somehow gain control by duplicating himself, and maybe even infecting other files. The player must counter this by duplicating himself as well, deleting the other files, and cleaning the infected files.

    To me, it doesn't seem like the easiest first game to make, assuming that it is your first. You may want to try something a little easier first, to get a hold on game programming. Try a text RPG with D&D rules or something, or ping pong.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  11. #11
    Registered User
    Join Date
    Oct 2003
    Posts
    13
    Well someone just kind of invented it on another site.

    Vb.exe and Virus.exe were just examples of a .exe name. It's not realy those ones but it is between two people's viruses. It isn't between the computer and the person but between a person and a person. That is what it does though, what you said under that.

    I can do a lot of the other stuff I just don't know how to tell if all files other then itself and its copies are gone.

    Thanks for your help.

  12. #12
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    If you want to check if a file or its copies are gone, without knowing the file names, you will have to check the contents of every single file in the directory. This will reduce performance. Since these files are executables, you can't exactly place a short unique header at the beginning of the files for quick identification. I would thus suggest that the renaming conventions be regular and consistent, ie, virus.exe, virus_01.exe, virus_02.exe. This way, you could just use a wildcard search to check for copies.

    Does that help?
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  13. #13
    Registered User
    Join Date
    Oct 2003
    Posts
    13
    Yeah, I guess I'll just look for strings and if they're not there then it will consider it as a different file.

    Thank you

  14. #14
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Originally posted by Ziimac
    Yeah, I guess I'll just look for strings and if they're not there then it will consider it as a different file.

    Thank you
    I strongly advise you against that method. You will be reading in a lot of data and searching through it, reducing your program's performance considerably. My method involving the file renaming convention would be better.

    Unless of course, your aim is to be able to disguise files by naming them random, discreet names. In that case, you would be forced to use your method.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. passing params between managed c++ and unmanaged c++
    By cechen in forum C++ Programming
    Replies: 11
    Last Post: 02-03-2009, 07:46 AM
  2. Smart pointer class
    By Elysia in forum C++ Programming
    Replies: 63
    Last Post: 11-03-2007, 07:05 AM
  3. DirectInput help
    By Muphin in forum Game Programming
    Replies: 2
    Last Post: 09-10-2005, 11:52 AM
  4. Headers that use each other
    By nickname_changed in forum C++ Programming
    Replies: 7
    Last Post: 10-03-2003, 04:25 AM
  5. Need Help With an RPG Style Game
    By JayDog in forum Game Programming
    Replies: 6
    Last Post: 03-30-2003, 07:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21