Writing an integer to a file

Stewart Gordon smjg_1998 at yahoo.com
Mon Mar 7 06:36:55 PST 2011


On 07/03/2011 12:11, %u wrote:
> this is part of the code:

Posting the whole code (or even better, a minimal, complete program that shows the 
problem) helps a lot.

> void WritePushPop(cmd command, string segment, int index)
> 		{
>                          string temp = "TextFile.Asm";
> 			AsmFile = new File(temp, FileMode.OutNew );
>
> 		        string x = toString(index);
>
> AsmFile.writeString("@");
>
> AsmFile.write(index);

File.write writes a binary representation of its argument.  To write a textual 
representation, use writef or writefln.

<snip>
> Now it wouldn't even build, it doesn't like the line: string x =
> toString(index);
> but this line works when I'm working with the console.

What's the error message?

Stewart.


More information about the Digitalmars-d-learn mailing list