// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; using System.Runtime.InteropServices; internal static partial class Interop { internal static partial class Sys { /// /// Takes a string and applies a formatting to it to transform /// parameters to input values (such as replacing %s in the string with a variable) /// /// The output buffer to put the transformed data into /// The size of the output buffer /// The input string with wildcards to be replaced /// The argument to replace a wildcard with /// /// Since snprintf has a variadic parameter, which cannot be described by C#, we have different /// PInvokes declared for each one we need. The PInvoke layer will take care of putting the /// arguments in correctly. /// /// /// Returns the number of characters (excluding null terminator) written to the buffer on /// success; if the return value is equal to the size then the result may have been truncated. /// On failure, returns a negative value. /// [LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF_1S", StringMarshalling = StringMarshalling.Utf8, SetLastError = true)] internal static unsafe partial int SNPrintF(byte* str, int size, string format, string arg1); /// /// Takes a string and applies a formatting to it to transform /// parameters to input values (such as replacing %s in the string with a variable) /// /// The output buffer to put the transformed data into /// The size of the output buffer /// The input string with wildcards to be replaced /// The argument to replace a wildcard with /// /// Since snprintf has a variadic parameter, which cannot be described by C#, we have different /// PInvokes declared for each one we need. The PInvoke layer will take care of putting the /// arguments in correctly. /// /// /// Returns the number of characters (excluding null terminator) written to the buffer on /// success; if the return value is equal to the size then the result may have been truncated. /// On failure, returns a negative value. /// [LibraryImport(Libraries.SystemNative, EntryPoint = "SystemNative_SNPrintF_1I", StringMarshalling = StringMarshalling.Utf8, SetLastError = true)] internal static unsafe partial int SNPrintF(byte* str, int size, string format, int arg1); } }