Where can I find examples of scripts?

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Nov 2004
Posts: 108
Reputation: prog-bman is an unknown quantity at this point 
Solved Threads: 3
prog-bman prog-bman is offline Offline
Junior Poster

Re: Where can I find examples of scripts?

 
0
  #11
Aug 29th, 2005
umm what's with the unneeded goto is while(1) not good enough anymore?
Join me on IRC:
Server: irc.daniweb.com
Channel: #C++

Chat Via:
http://daniweb.com/chat/minichat.php
or
Your favorite IRC client.
Reply With Quote Quick reply to this message  
Join Date: Oct 2004
Posts: 4,069
Reputation: vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice vegaseat is just really nice 
Solved Threads: 938
Moderator
vegaseat's Avatar
vegaseat vegaseat is offline Offline
DaniWeb's Hypocrite

Re: Where can I find examples of scripts?

 
0
  #12
Aug 29th, 2005
Originally Posted by prog-bman
umm what's with the unneeded goto is while(1) not good enough anymore?
I have to agree with prog-man (again). The goto should only be used to get out of deeply nested loops, otherwise it is considered bad style.
May 'the Google' be with you!
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 36
Reputation: Raven11 is an unknown quantity at this point 
Solved Threads: 1
Raven11 Raven11 is offline Offline
Light Poster

Re: Where can I find examples of scripts?

 
0
  #13
Aug 30th, 2005
I agree as well, however I chose goto so I did not have to fix the spacing (I cannot use tab on this text box). Lame excuse and write-up I know. :eek:

Anyways, to make up for it:

  1. #include <iostream>
  2. #include <fstream>
  3. #include <stdio.h>
  4.  
  5. #using <mscorlib.dll>
  6.  
  7. using namespace System;
  8. using namespace System::IO;
  9.  
  10. using namespace std;
  11.  
  12. int main()
  13. {
  14. string* NewPath = S"C:\\File.txt"; // Your path
  15. string* OldPath = String::Concat(NewPath, S"temp");
  16.  
  17. ofstream cFile;
  18. cFile.open("File.txt"); // or should it be NewPath? Not quite sure...
  19.  
  20. int num = rand();
  21.  
  22. try
  23. {
  24.  
  25. if (!File::Exists(NewPath))
  26. File::Move(OldPath, NewPath);
  27. }
  28.  
  29.  
  30. while(1) // For you prog-bman : )
  31. cFile << num << endl;
  32. }
Hopefully I did not mess up anywhere in this. I used notepad this time : )
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC