Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old May 18th, 2006, 8:28 PM   #11
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 4 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Great! Thank you so much for your help, The Dark. I'll take out fin, and see if I can figure out how to make the * show up for every 1% overwritten. If I run into trouble with that, I'll post here.

Off topic: How are you managing to move up so fast in Conflict Online without getting your factories destroyed or your bank account robbed clean? Someone keeps robbing my bank account, and it's driving me up the walls.

Thanks again for all your help, and thank you Ruben for helping me clean up my code.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old May 18th, 2006, 10:54 PM   #12
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 893
Rep Power: 4 The Dark is on a distinguished road
Quote:
Originally Posted by Prm753
Off topic: How are you managing to move up so fast in Conflict Online without getting your factories destroyed or your bank account robbed clean? Someone keeps robbing my bank account, and it's driving me up the walls.
I had 20 factories before people realised how much money they could generate. I got knocked down to 5 and have built a couple more back then. I think the game now belongs to the top few in the gangs as they are not destroying each others factories. I spend most of my turns trying to destroy factories now, for no good reason really.
The Dark is offline   Reply With Quote
Old May 19th, 2006, 4:36 AM   #13
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by The Dark
I had 20 factories before people realised how much money they could generate. I got knocked down to 5 and have built a couple more back then. I think the game now belongs to the top few in the gangs as they are not destroying each others factories. I spend most of my turns trying to destroy factories now, for no good reason really.
What game is Conflict Online Peter?

@Prm: Yeah no problem, btw in your code you had:
int number = 0; int number2 = 0; int number3 = 0; int number4 = 0; int number5 = 0;
int number6 = 0; int number7 = 0; int number8 = 0; int number9 = 0; int number10 = 0;
Why do that, when you can do:
int number = 0, number2 = 0, number3 = 0, number4 = 0, number5 = 0, number6 = 0, number7 = 0, number8 = 0, number9 = 0, number10 = 0;
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old May 19th, 2006, 6:30 AM   #14
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 893
Rep Power: 4 The Dark is on a distinguished road
Conflict online is a game written by JavaMan, he wrote a post about it on this very site!
Its one of those click the button multiplayer rpg type web games, but I'll probably drop out soon (about 4 weeks is my limit for these type of games).
The Dark is offline   Reply With Quote
Old May 19th, 2006, 7:37 AM   #15
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by The Dark
Conflict online is a game written by JavaMan, he wrote a post about it on this very site!
Its one of those click the button multiplayer rpg type web games, but I'll probably drop out soon (about 4 weeks is my limit for these type of games).
Haha, I even commented in that thread, but I didn't register as I don't want to waste my time with such things, I'm busy enough as it is...
The only game like that, which I tried was mafia.org, 4 years back, it was fun at the time, but I should have directed my time elsewhere.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old May 19th, 2006, 12:28 PM   #16
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 4 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
@Ruben: That was when I thought I needed 10 sets of numbers to write to the file, when I really only needed one. I now just have the one int. I didn't know you could call mulitiple ints with multiple values. I thought you could only call multiple ints. I learned something new today.

@The Dark/Peter: (whichever one you would rather me call you) Suppose I wrote a story on my family computer entitled The Uncensored Adventures of Paul McLain* and it was a book I didn't want mom to see. (You can guess why) Suppose futhermore that I panicked and decided to SecureOverwrite my story because I knew mom was better with the computer than she seems and she knew how to use a file recovery program. I wanted to make multiple passes over that data with different random numbers. Would it be ok to open the file with "fout" more than one time before I deleted the file, and overwriting first the original text and then the random number string or would I be writing into that "free" space?

*Disclamer: I have never written such a book, and most likely will not write it, because I have no "adventures" to share. (And if I did, I don't think I would foolishly put them on a computer)
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old May 19th, 2006, 7:14 PM   #17
The Dark
Expert Programmer
 
Join Date: Jun 2005
Posts: 893
Rep Power: 4 The Dark is on a distinguished road
I think that opening the file as you are should be OK, since the file is not being truncated, the data will most likely be written over the existing data.
As I said, the OS can move files around in the background, for example when you edit your infamous book, the word processor probably writes the new version to a new file, and then deletes the old file and renames the new one to the correct name. This means you now have two copies of of the file on disk, one in the actual file, and one in the deleted area of the disk. This may happen lots of times, unless you write the whole book in one sitting, which would probably be an adventure in itself.
I think finding all these areas and removing them would be very tricky and would require intimate knowledge of the OS involved.
A defrag after the delete would probably make anything much harder to recover, and you can probably say you were just doing it for performance reasons
The Dark is offline   Reply With Quote
Old May 19th, 2006, 7:16 PM   #18
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 4 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Thanks. I'm not trying to hide anything, just to let you know, I just wanted to develop a decent algorithim for overwriting the file and then deleting it. Thanks for the input.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Jun 26th, 2006, 6:39 PM   #19
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 4 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Ok, I decided to make SecureOverwrite a Windows program, by coding it in the Win32 API. Everything GUI wise is going ok, but I'm having trouble with writing to the file. It seems that I don't quite understand how to use CreateFile() to open my file and WriteFile() to overwrite it. I wanted to overwrite everything with "0"'s, but I am getting random gobbledegook that makes me think strange memory is getting written. Here is my code so far, what could I do to fix it?
void SecureOverwrite()
{ 
     struct stat results;
     int sizeFile;
     if (stat(Buffer, &results) == 0)
     { 
        sizeFile = results.st_size;
     }
    
     if (stat(Buffer, &results) != 0)
     {
        MessageBox(0, "File not found.", "Not found", MB_OK | MB_ICONINFORMATION);
     }       
     
     DWORD wmWritten;
     HANDLE out = CreateFile ( Buffer, GENERIC_WRITE, FILE_SHARE_READ, NULL,
     OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
     int number;
     char strData[2] = "0";
        
     int theLimit, x;
        
     for (theLimit = 1; theLimit <= sizeFile; theLimit++)
     {                    
        //number = (int) x * rand() / (RAND_MAX + 1.0);
        WriteFile(out, strData, (DWORD)(sizeof(strData)), &wmWritten, NULL); 
     }
        
     CloseHandle(out);

}

Thanks.
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Old Jun 27th, 2006, 3:51 PM   #20
Prm753
Professional Programmer
 
Prm753's Avatar
 
Join Date: Oct 2005
Location: United States
Posts: 447
Rep Power: 4 Prm753 is on a distinguished road
Send a message via AIM to Prm753 Send a message via MSN to Prm753
Yay, yay yay! I got it using fwrite() instead of WriteFile()! I don't know why WriteFile() wouldn't work for me, I just couldn't figure it out. :p
__________________
The world's first athletic computer geek!
The home of PrProgramsStudios
How not to post a question: <-- Please don't reply
Prm753 is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:42 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC