Sythe.Org Forums     Register     FAQ     Members List     Calendar     Mark Forums Read    
 
Sythe.Org Forums  
   Runescape Gold

Sythe.org — A Virtual Goods Trading Hub

Make real cash! buying and selling in-game items.

We have a no-scam policy.

You can make thousands playing your favourite games here at Sythe.org.

Just sign up an account and follow the rules!


Take me to

Runescape Markets

Other Game Markets

Support Center

Register an Account

Close
Using StreamWriter
Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 03-06-2011, 03:34 AM
Member
 
Join Date: Dec 2010
Posts: 35
Default Using StreamWriter

I don't feel showing my code is necessary, so here's the idea.
I create a StreamWriter, write to a the file, close it, email it, then erase it using File.WriteAll(path, "").
The problem is that i'm trying to do this using a loop, and I can't use the StreamWriter again in the loop because I have closed it. Is there a way to reopen it? or what other options are there?
Reply With Quote
  #2  
Old 03-06-2011, 04:07 AM
Member
BANNED
 
Join Date: Mar 2011
Posts: 33
Default Re: Using StreamWriter

Pretty much screwed
Reply With Quote
  #3  
Old 03-23-2011, 11:55 PM
Jeezal's Avatar
Forum Addict
 
Join Date: Mar 2011
Posts: 285
Send a message via MSN to Jeezal
Default Re: Using StreamWriter

thats a bit f up

Last edited by Jeezal : 03-23-2011 at 11:56 PM.
Reply With Quote
  #4  
Old 03-26-2011, 09:42 PM
Member
 
Join Date: Jun 2007
Location: Denmark
Posts: 71
Default Re: Using StreamWriter

Quote:
Originally Posted by ScubaSteve7 View Post
I don't feel showing my code is necessary, so here's the idea.
I create a StreamWriter, write to a the file, close it, email it, then erase it using File.WriteAll(path, "").
The problem is that i'm trying to do this using a loop, and I can't use the StreamWriter again in the loop because I have closed it. Is there a way to reopen it? or what other options are there?
for(int i = 0;i > MyLoop;i++)
{
StreamWriter sw = new StreamWriter("myfile.txt");
sw.write("lol");
sw.Close();
E-mail();
if(Exists("myfile.txt"))
{
File.Delete("myfile.txt");
}
}

Thats how i whould do it..
__________________
Quote:
Originally Posted by World Gamer Forum View Post
VOUCH 33-60 agility!
Quote:
Originally Posted by Throne View Post
Vouch for Puffo! Got my strength from 46 to 57 for FREE!
Reply With Quote
  #5  
Old 03-30-2011, 09:10 PM
Member
 
Join Date: Dec 2010
Posts: 35
Default Re: Using StreamWriter

Quote:
Originally Posted by Puffo View Post
for(int i = 0;i > MyLoop;i++)
{
StreamWriter sw = new StreamWriter("myfile.txt");
sw.write("lol");
sw.Close();
E-mail();
if(Exists("myfile.txt"))
{
File.Delete("myfile.txt");
}
}

Thats how i whould do it..

Can't delete because it says file is in use by another operation.
Reply With Quote
  #6  
Old 04-05-2011, 03:23 PM
Member
 
Join Date: Jun 2007
Location: Denmark
Posts: 71
Default Re: Using StreamWriter

sw.Dispose();
__________________
Quote:
Originally Posted by World Gamer Forum View Post
VOUCH 33-60 agility!
Quote:
Originally Posted by Throne View Post
Vouch for Puffo! Got my strength from 46 to 57 for FREE!
Reply With Quote
  #7  
Old 11-18-2011, 04:50 PM
MonsterMMORPG's Avatar
Member
 
Join Date: Nov 2011
Posts: 53
Default Re: Using StreamWriter

be sure that you are using this

using () {}

or close streamwriter yourself
__________________
F2P Pokemon Style Monster MMORPG Developer


Reply With Quote
  #8  
Old 03-29-2012, 08:19 AM
Newcomer
 
Join Date: Mar 2012
Posts: 12
Default Re: Using StreamWriter

using (streamwriter sw=new streamwriter())
{}

the streamwriter should be close
Reply With Quote
  #9  
Old 04-16-2012, 05:00 AM
Member
 
Join Date: Apr 2012
Posts: 82
Default Re: Using StreamWriter

dispose it
Reply With Quote
Reply



Cheap RS Gold Store  Runescape Gold

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

All times are GMT +1. The time now is 06:41 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.6.1