how to read the text from the file???
how read text below??
†‰€ˆ†‰#îõ‘þüš ꑯõù ‚†ƒ -#ª÷‘þü “‘ ª“îù )øþ¦ùý ¤ª—ùý î‘õ•þø—¤(#•¢þ¢ ø¤÷¢ù ꑯõù îõ‘þü#^a—ú¤ö^b•¦øû÷¢ð‘ö ¤ù ¢÷©^cˆˆƒ#‚€ «.: õ¬ø¤š ›¢øñ#……ˆí/š…/ …€…š}tk{^aˆˆƒ#†/„€€#}bf{#ª“îùû‘ý î‘õ•þø—¤ý#ª“îùû‘ý î‘õ•þø—¤ý -- ¥õøöû‘#^c
i use code not display characters???
filestream fs = new filestream(open.filename, filemode.open, fileaccess.read); system.text.encoding enc = system.text.encoding.utf8 ; byte[] data = new byte[fs.length]; fs.read(data, 0, data.length); string text = enc.getstring(data);
and show text :
†‰€ë†â€¡â€°â#ã®ãµâ� �˜ã¾ã¼å ãªâ€˜â¯ãµã¹ ‚†æ’â -#ââªã·â€˜ã¾ã¼ “‘ âªâ€œã®ã¹ )ã¸ã¾â¦ã¹ã½ â¤âªâ€”ã¹ã½ ã®â€˜ãµâ€¢ã¾ã¸â€”â¤(#â€� �â¢ã¾â¢â ã¸â¤ã·â¢ã¹ ãªâ€˜â¯ãµã¹ ã®ãµâ€˜ã¾ã¼#^a—ãºâ¤â㶠^b•â¦ã¸ã»ã·â¢ã°â€˜ã¶ â¤âã¹ â¢âã·â©^cë†ë†æ’â#‚₠¬â â«.: ãµâ¬ã¸â¤å ›â¢ã¸ã±#…â…ë†ã/å …/ …€â…å }tk{^aë†ë†æ’â#†/„€€#}bf{#âªâ€œã®ã¹ã» ‘㽠ã®â€˜ãµâ€¢ã¾ã¸â€”â¤ã½#â� �“ã®ã¹ã»â€˜ã½ ã®â€˜ãµâ€¢ã¾ã¸â€”â¤ã½ -- ââ¥ãµã¸ã¶ã»â€˜#^c
text contains extended characters , need use binary reader class. try using following code.
filestream fs = new filestream(@"c:\documents , settings\user\desktop\sample.txt", filemode.open); binaryreader br = new binaryreader(fs); byte[] data = br.readbytes((int)fs.length);
veerakondalu.
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment