0

What do i do?

an error showing that

too many characters in character literals

 using(var fileStream = appStorage.OpenFile!('note.txt', System.IO.FileMode.OpenOrCreate))
Abe Miessler
  • 82,532
  • 99
  • 305
  • 486
user2498912
  • 49
  • 1
  • 1
  • 2
    Use a string, not a character literal. – ta.speot.is Jun 18 '13 at 22:05
  • 6
    Why is this question getting downvoted so much? I didn't think that questions were supposed be voted on by the level of difficulty of finding the answer. (Maybe it's easy to you, but the person is a new coder and doesn't know how to search for the right things to find the answer yet) – Jeremy Pridemore Jun 18 '13 at 22:29
  • 3
    I agree with Jeremy. Downvote if the question is off topic or has no code example or shows no effort whatsoever. But just because the question could be "dumb" to some people does not merit a downvote. While I agree that the OP could have found the answer by simply searching google for `too many characters in character literals c#` he or she may not know how to properly search for programming answers yet. Educate, don't belittle. – Evan L Jun 18 '13 at 22:38
  • @JeremyPridemore: The question is downvoted because it shows no evidence that the poster did any work whatsoever in answering the question themselves. Had they typed the question into the Bing, Google or StackOverflow search boxes they'd have found the answer without having to waste anyone else's time. – Eric Lippert Jun 18 '13 at 22:54
  • 3
    I note also that this should not have been closed as "not constructive". It's a perfectly constructive question. It should have been closed as a duplicate of http://stackoverflow.com/questions/5606664/getting-a-too-many-characters-in-charater-literal-error-please-help – Eric Lippert Jun 18 '13 at 22:55

1 Answers1

10

your problem is here:

'note.txt'

You need to change it to :

"note.txt"

Single quotes are used to define chars, so 'c', 'a' or 'm' are all valid uses of single quote. If you will have multiple characters you are defining a string and need to use double quotes.

And get rid of the ! in OpenFile!

Abe Miessler
  • 82,532
  • 99
  • 305
  • 486