-
-
Save ranha/1283261 to your computer and use it in GitHub Desktop.
Dartでファイルから1バイト読み込もうとする
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dartcでコンパイルしようとした場合次のようになる | |
ranha@ranha:~/dart_full/dart$ ./out/Debug_ia32/dartc ~/dart/read1bytefromfile.dart | |
file:/home/ranha/dart/read1bytefromfile.dart/read1bytefromfile.dart:9: no such type "File" | |
8: main() { | |
9: var f = new File("read1bytefromfile.dart",false); | |
file:/home/ranha/dart/read1bytefromfile.dart/read1bytefromfile.dart:9: New expression does not resolve to a constructor | |
8: main() { | |
9: var f = new File("read1bytefromfile.dart",false); | |
Compilation failed with 2 problems. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dartでは実行出来る | |
% dart_bin read1bytefromfile.dart | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import("dart:coreimpl"); | |
String char2string(int char) | |
{ | |
return StringBase.createFromCharCodes([ char ]); | |
} | |
main() { | |
var f = new File("read1bytefromfile.dart",false); | |
int i = f.readByte(); | |
print(char2string(i)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment