Click here to Skip to main content
16,018,158 members
Home / Discussions / C#
   

C#

 
GeneralRe: a table of arraylist Pin
Saksida Bojan15-Oct-09 8:23
Saksida Bojan15-Oct-09 8:23 
GeneralRe: a table of arraylist Pin
Luc Pattyn15-Oct-09 8:45
sitebuilderLuc Pattyn15-Oct-09 8:45 
GeneralRe: a table of arraylist Pin
Luc Pattyn15-Oct-09 8:47
sitebuilderLuc Pattyn15-Oct-09 8:47 
GeneralRe: a table of arraylist Pin
OriginalGriff15-Oct-09 8:42
mveOriginalGriff15-Oct-09 8:42 
AnswerRe: a table of arraylist [modified] Pin
Saksida Bojan15-Oct-09 8:21
Saksida Bojan15-Oct-09 8:21 
QuestionAccess denied on opening a file for writing Pin
Member 405249815-Oct-09 7:45
Member 405249815-Oct-09 7:45 
AnswerRe: Access denied on opening a file for writing Pin
OriginalGriff15-Oct-09 7:59
mveOriginalGriff15-Oct-09 7:59 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 8:51
Member 405249815-Oct-09 8:51 
There was already calls to Close(), but I tried with using. It's the same, when I want to write to the second file, I still have the same message ...
Here is the reading code :

private List<Ligne> getLignesFromFile(String sFichier)
{
  List<Ligne> oListe = new List<Ligne>();

  using (TextReader oTR = new StreamReader(sFichier, Encoding.Default))
  {
    String sContenu = oTR.ReadToEnd();

    try
    {
      oListe = SrtFileParser.parseString(sContenu);
    }
    catch (Exception e)
    {
      throw e;
    }
  }
  return oListe;
}



And writing code :

public bool ecrireFichier(String sNomFichier)
{
  using (TextWriter oTW = new StreamWriter(sNomFichier, false, Encoding.Default))
  {
    try
    {
      // code writing data to first file
    }
    catch (Exception e)
    {
      throw e;
    }
  }

  if (CountTotalWordsTranslated() > 0)
  {
    String sFichierTemp = TranslationUtilities.generateTempFileName(sNomFichier);
    ecrireTraduction(sFichierTemp, MissingTranslation.DoNotExport);

  }
  return true;
}


public bool ecrireTraduction(String sNomFichier, MissingTranslation mt)
{
  using (TextWriter oTW = new StreamWriter(sNomFichier, false, Encoding.Default))
  {
    // code writing data to second file
  }
  return true;
}


The problem happens in the ecrireTraduction function. The call to the StreamWriter constructor fails, and throws an exception.

That's the only code in the whole application dealing with those files ...
AnswerRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 8:01
sitebuilderLuc Pattyn15-Oct-09 8:01 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 9:00
Member 405249815-Oct-09 9:00 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 9:21
sitebuilderLuc Pattyn15-Oct-09 9:21 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 9:58
Member 405249815-Oct-09 9:58 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 10:07
sitebuilderLuc Pattyn15-Oct-09 10:07 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 10:16
Member 405249815-Oct-09 10:16 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 10:25
sitebuilderLuc Pattyn15-Oct-09 10:25 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 10:34
Member 405249815-Oct-09 10:34 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 10:50
sitebuilderLuc Pattyn15-Oct-09 10:50 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 11:13
Member 405249815-Oct-09 11:13 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 11:57
sitebuilderLuc Pattyn15-Oct-09 11:57 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 21:40
Member 405249815-Oct-09 21:40 
GeneralRe: Access denied on opening a file for writing Pin
Member 405249815-Oct-09 9:21
Member 405249815-Oct-09 9:21 
GeneralRe: Access denied on opening a file for writing Pin
Luc Pattyn15-Oct-09 9:26
sitebuilderLuc Pattyn15-Oct-09 9:26 
QuestionProblems with disposing rescources Pin
Kaare Tragethon15-Oct-09 7:37
Kaare Tragethon15-Oct-09 7:37 
AnswerRe: Problems with disposing rescources Pin
I Believe In GOD15-Oct-09 7:46
I Believe In GOD15-Oct-09 7:46 
GeneralRe: Problems with disposing rescources Pin
Kaare Tragethon15-Oct-09 7:49
Kaare Tragethon15-Oct-09 7:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.