GtkSharp/glib/FileUtils.cs
Miguel de Icaza f1e095a87b 2003-11-27 Miguel de Icaza <miguel@ximian.com>
* glib/Log.cs: Make LogLevelFlags CLS compliant.

	* glib/SignalCallback.cs: Set the constructor protection level to
	protected, since it can not be instantiate.d

	* glib/Marshaller.cs: Do not allow instances of this class as it
	only exposes static methods.

	* glib/Source.cs, glib/FileUtils.cs, glib/Timeout.cs,
	glib/Thread.cs, glib/Markup.cs, glib/TypeConverter.cs: Ditto.

svn path=/trunk/gtk-sharp/; revision=20573
2003-11-28 05:29:34 +00:00

31 lines
707 B
C#

// GLib.FileUtils.cs - GFileUtils class implementation
//
// Author: Martin Baulig <martin@gnome.org>
//
// (c) 2002 Ximian, Inc
namespace GLib {
using System;
using System.Text;
using System.Runtime.InteropServices;
public class FileUtils
{
[DllImport("libglib-2.0-0.dll")]
extern static bool g_file_get_contents (string filename, out IntPtr contents, out int length, out IntPtr error);
public static string GetFileContents (string filename)
{
int length;
IntPtr contents, error;
if (!g_file_get_contents (filename, out contents, out length, out error))
throw new GException (error);
return Marshal.PtrToStringAnsi (contents, length);
}
private FileUtils () {}
}
}