4
以下是來自msdn的教程。 _flushall的輸出是教程中的「測試」,但是我通過使用console.write()顯示輸出來獲得「2」。請有人解釋一下嗎?平臺pinvoke教程msdn
using System;
using System.Runtime.InteropServices;
class PlatformInvokeTest
{
[DllImport("msvcrt.dll")]
public static extern int puts(string c);
[DllImport("msvcrt.dll")]
internal static extern int _flushall();
public static void Main()
{
puts("Test");
_flushall();
}
}
從[MSDN documentatation](http://msdn.microsoft.com/en-us/library /s9xk9ehd.aspx)爲_flushAll,該方法返回打開流的數量。另外,_flushAll的返回類型是int。所以,它不能是「測試」。但是,上述程序的輸出是「測試」,因爲這是通過調用puts方法打印的。 – sthotakura
確實返回類型是int。我如何獲得「測試」的價值呢? – arjun
如果我正確理解您的評論,則通過調用put函數將「Test」打印到控制檯。 – sthotakura