On 4 February 2007 at 20:17, cstrato wrote: | I am currently learning how to create R packages using C++ classes.
Congratulations :) [ This reminds me to email Oleg (CC'ed). Oleg, your HOWTO is a very useful. Would you consider adding a section on Dominick's most excellent RcppTemplate package which makes writing code to go back and forth between R and C++ soooo much easier? ] | For this purpose I have written a small package MyClass (which I try | to attach since I do not have access to a website). [...] | While I can compile and execute my package w/o problems on Fedora Core 4, Works for me too on Debian. [...] | > writeFileCpp("myout_fileCpp.txt") | [1] "outfile = myout_fileCpp.txt" | Writing file myout_fileCpp.txt using C++ style. | ---MyClassA::MyClassA()--------- | ---MyClassA::WriteFileCpp--------- | | *** caught bus error *** | address 0x6, cause 'non-existent physical address' | | Traceback: | 1: .C("WriteFileCpp", as.character(outfile), PACKAGE = "MyClass") | 2: writeFileCpp("myout_fileCpp.txt") | | | While I understand, that C++ iostreams are best avoided, since there is | no guarantee that the output will appear in the R console (as mentioned | on page 62 of R-exts.pdf), I do not understand why I cannot use ofstream, | which is isolated in a C++ method only. | | Is there a way how to use ofstream on MacOS X or is this a limit of the | current Mac implementation? Can you get to this in a debugger on MacOS X? Just glancing at your code I saw nothing obviously sticking out... Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel