This should be trivial. However, I've not found in the documentation (trying
both std.stdio and std.file) how to write to a file in the manner here:
filename.writefln(%s\t%f, someString, someDouble);
... this merely prints filename to screen ... does not create a data file.
Thank you. Indeed, I forgot: auto f = File(outfile.txt, w);
Interestingly, this apparently works within a for-loop to overwrite the file on
the first iteration and appending otherwise (Should there not be an explicit
append arg?):
for(int i = 0; i 100; i++) {
f.writefln(%s%i, World Hello,
Is there a way to preserve an array's original order, or to sort an assoc arr
by key?
With code like the following, the values of the string indices allow foreach
to needlessly re-order the array:
...
double[string][string] val;
...
foreach(string1, row; val) {
foreach(string2, col; row) {
The class code below runs terribly slow. Conversely, when converted into a
function (albeit returning only one value), it runs fast. Any insights into
this or suggestions to get a function to return multiple types at once?
...library code...
module testlib;
import std.stdio, std.string;
class
Jonathan, thank you for the quick response. I made some changes as you
suggested
and got much more speed. For some code that I'd like to convert to D, I am
exploring the pros and cons of constructing a class library (versus a C like
function library). My code here is just part of that