D.gnu - File example
- manfred toppoint.de (34/34) Apr 10 2003 Hi,
- Manfred Hansen (19/19) Apr 11 2003 Hello,
Hi, import stream; import c.stdio; int main (char[][] args) { File dst = new File(); dst.create("new_file"); dst.writeString("Hi"); return 0; } I get the following errors, hansen hansen-lx:~/d/dli-0.1.2$ /file_write 32727 3.272748e+04 Permission denied Dumping core Gleitkomma-Ausnahme ---------- 1 hansen hansen 0 10. Apr 09:35 new_file Have someone a better example. Is it possible by dst.create() to change the mode, for example 777 . And how can i open a file for "read, write or append"? Best Regards Manfred Hansen
Apr 10 2003
Hello, this program read and write a file to disk. import stream; import c.stdio; int main() { FILE *fpr; File kwd = new File("TODO"), dst = new File(); fpr=fopen("test.txt","a"); while (!kwd.eof()) { fprintf(fpr,kwd.readLine()~"\n","test.txt"); } kwd.close; if((fclose(fpr)) != 0) { perror("fclose"); /* Reaktion auf Fehler */ } return 0; } Regards, Manfred Hansen
Apr 11 2003