einbinden einer statischen Bibliothek
-
Hallo, ich würde gerne in meinem Programm eine statische Bibliotek verwenden die ich im Internet entdeckt habe, erzeugen eines virtuellen Filesystems, jetzt habe ich die *.lib datei und 2 heasderdateien leider sind die headerdateien nicht in ansi-c geschrieben. Meine Frage nun: kann man die Umschreiben um die *.lib dann zu verwenden? ich post mal die 2 header Dateien
//**************************************************************************** //** //** VFS_TYPES.H //** Header - Virtual File System Configuration //** //** Project: VFS //** Component: VFS //** Author: Michael Walter //** //** History: //** 25.07.2001 Created (Michael Walter) //** //**************************************************************************** #ifndef VFS_VFS_CONFIG_H #define VFS_VFS_CONFIG_H //============================================================================ // COMPILER SETTINGS //============================================================================ #ifdef _MSC_VER #pragma warning ( disable : 4786 ) #endif //============================================================================ // INTERFACE REQUIRED HEADERS //============================================================================ #include <vector> #include <map> #include <string> #include <cstring> //============================================================================ // WIN32 CONFIGURATION //============================================================================ #ifdef _WIN32 # include <windows.h> # include <io.h> # if defined( _MSC_VER ) # pragma comment( lib, "vfs.lib" ) # pragma warning( disable : 4311 ) # pragma warning( disable : 4312 ) # if defined( _DEBUG ) # define VFS_DEBUG # endif # endif //============================================================================ // PLATFORM-DEPENDANT FUNCTIONS //============================================================================ # define VFS_UNLINK( strAbsoluteFileName ) ( ( _wunlink( ( strAbsoluteFileName ).c_str() ) == 0 ) ? VFS_TRUE : VFS_FALSE ) # define VFS_RENAME( strAbsoluteFileName, strTo ) ( ( _wrename( ( strAbsoluteFileName ).c_str(), strTo.c_str() ) == 0 ) ? VFS_TRUE : VFS_FALSE ) # define VFS_MKDIR( strAbsoluteDirName ) ( ( _wmkdir( ( strAbsoluteDirName ).c_str() ) == 0 ) ? VFS_TRUE : VFS_FALSE ) # define VFS_RMDIR( strAbsoluteDirName ) ( ( _wrmdir( ( strAbsoluteDirName ).c_str() ) == 0 ) ? VFS_TRUE : VFS_FALSE ) # define VFS_EXISTS( strAbsoluteFileName ) ( ( GetFileAttributesW( ( strAbsoluteFileName ).c_str() ) != 0xFFFFFFFF ) ? VFS_TRUE : VFS_FALSE ) # define VFS_IS_DIR( strAbsoluteDirName ) ( ( GetFileAttributesW( ( strAbsoluteDirName ).c_str() ) != 0xFFFFFFFF && ( GetFileAttributesW( strAbsoluteDirName.c_str() ) & FILE_ATTRIBUTE_DIRECTORY ) == FILE_ATTRIBUTE_DIRECTORY ) ? VFS_TRUE : VFS_FALSE ) # define VFS_FOPEN( strAbsoluteFileName, strAccess ) ( _wfopen( ( strAbsoluteFileName ).c_str(), ( strAccess ).c_str() ) ) # define VFS_RESIZE( pFile, lSize ) ( ( _chsize( m_pFile->_file, lSize ) == 0 ) ? VFS_TRUE : VFS_FALSE ) # define VFS_GETSIZE( pFile ) ( _filelength( m_pFile->_file ) ) //============================================================================ // INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS //============================================================================ // Numeric Types. typedef bool VFS_BOOL; typedef unsigned char VFS_BYTE; typedef unsigned short VFS_WORD; typedef unsigned long VFS_DWORD; typedef int VFS_INT; typedef unsigned int VFS_UINT; typedef long VFS_LONG; // Numeric Macros. static const VFS_BOOL VFS_TRUE = true; static const VFS_BOOL VFS_FALSE = false; // String types. typedef wchar_t VFS_CHAR; typedef wchar_t* VFS_PSTR; typedef const wchar_t* VFS_PCSTR; typedef std::wstring VFS_String; // String Macros. #define VFS_TEXT( string ) L ## string // Loword/Hiword Macros (for Versioning) #define VFS_HIBYTE( word ) ( ( VFS_BYTE )( ( ( VFS_WORD ) word ) >> 8 ) ) #define VFS_LOBYTE( word ) ( ( VFS_BYTE )( ( ( VFS_WORD ) word ) & 0xFF ) ) #define VFS_HIWORD( dword ) ( ( VFS_WORD )( ( ( VFS_DWORD ) dword ) >> 16 ) ) #define VFS_LOWORD( dword ) ( ( VFS_WORD )( ( ( VFS_DWORD ) dword ) & 0xFFFF ) ) #define VFS_MAKE_WORD( lo, hi ) ( ( VFS_WORD )( ( ( VFS_BYTE ) lo ) | ( ( VFS_WORD ) ( ( ( VFS_BYTE ) hi ) << 8 ) ) ) ) #define VFS_MAKE_DWORD( lo, hi ) ( ( VFS_DWORD )( ( ( VFS_WORD ) lo ) | ( ( VFS_DWORD ) ( ( ( VFS_WORD ) hi ) << 16 ) ) ) ) //============================================================================ // INTERFACE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES //============================================================================ //============================================================================ // INTERFACE STRUCTURES / UTILITY CLASSES //============================================================================ //============================================================================ // INTERFACE DATA DECLARATIONS //============================================================================ //============================================================================ // INTERFACE FUNCTION PROTOTYPES //============================================================================ inline VFS_BOOL VFS_FIND_FILE( const VFS_String& strAbsoluteFileName, VFS_String& strFoundName, VFS_BOOL& bIsDir, VFS_LONG& lSize, VFS_INT nMode ) { static HANDLE hFindFile = NULL; WIN32_FIND_DATAW wfd; if( nMode == 0 ) { if( ( hFindFile = FindFirstFileW( strAbsoluteFileName.c_str(), &wfd ) ) == INVALID_HANDLE_VALUE ) return VFS_FALSE; strFoundName = wfd.cFileName; bIsDir = ( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) == FILE_ATTRIBUTE_DIRECTORY; lSize = wfd.nFileSizeLow; return VFS_TRUE; } else if( nMode == 1 ) { if( !FindNextFileW( hFindFile, &wfd ) ) return VFS_FALSE; strFoundName = wfd.cFileName; bIsDir = ( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) == FILE_ATTRIBUTE_DIRECTORY; lSize = wfd.nFileSizeLow; return VFS_TRUE; } else if( nMode == 2 ) { return FindClose( hFindFile ) ? VFS_TRUE : VFS_FALSE; } return VFS_FALSE; } //============================================================================ // INTERFACE OBJECT CLASS DEFINITIONS //============================================================================ //============================================================================ // TRAILING CONFIGURATION SECTIONS //============================================================================ //============================================================================ // INTERFACE TRAILING HEADERS //============================================================================ #else # error VFS: Unsupported Platform. Please add a configuration section for your platform and publish it to the community be emailing me at michiwalter@gmx.de #endif #endif // __VFS_VFS_TYPES_H__und die andere
//**************************************************************************** //** //** VFS.H //** Header - Virtual File System //** //** Project: VFS //** Component: VFS //** Author: Michael Walter //** //** History: //** 18.06.2001 Created (Michael Walter) //** //** Note: //** There may only be 32 used Filters per Archive. //** The length of an Archive Entity's Names may not exceed VFS_MAX_NAME_LENGTH //** UNICODE Characters. //** Never use file names like ../../bla/bla.txt or something like that, because the VFS //** doesn't have something like a current drive and/or directory. //** Never use file names like "bla.vfsa" or "bla." + VFS_ARCHIVE_FILE_EXTENSION. //** Archives that have been created on Little Endian Machines can't be used under //** Big Endian Machines and vice versa. //** //** New: //** If the VFS_File_Read() or the VFS_FilterReadProc is called for EOF, it returns just VFS_FALSE //** WITHOUT settings an Error Code. This allows nice loops like //** while( Read( ... ) ) Write( ... ); //** Check for the VFS_GetLastError() == VFS_ERROR_NONE after such a loop! //** For small global Information, use the SaveConfigData() and LoadConfigData() functions. For //** other, dynamic issues you'd also just use the Encode()/Decode() Callbacks to store for //** for instance a decryption md5 in front of each file. //** //** Note: //** Though VFS is designed for platform independence, it will be the job of the readers of the //** tutorial to write a version of it that supports case-sensitive file system. //** //**************************************************************************** #ifndef VFS_VFS_H #define VFS_VFS_H //============================================================================ // INTERFACE REQUIRED HEADERS //============================================================================ #include "VFS_Config.h" //============================================================================ // INTERFACE DEFINITIONS / ENUMERATIONS / SIMPLE TYPEDEFS //============================================================================ // The Handle Type. enum VFS_Handle { VFS_HANDLE_FORCE_DWORD = 0xFFFFFFFF }; // Various Constants. static const VFS_WORD VFS_VERSION = VFS_MAKE_WORD( 0, 1 ); // Version 1.0 static const VFS_CHAR VFS_PATH_SEPARATOR = VFS_TEXT( '/' ); static const VFS_CHAR* VFS_ARCHIVE_FILE_EXTENSION = VFS_TEXT( "VFSA" ); static const VFS_MAX_NAME_LENGTH = 64; static const VFS_Handle VFS_INVALID_HANDLE_VALUE = ( VFS_Handle ) 0; static const VFS_DWORD VFS_INVALID_DWORD_VALUE = 0xFFFFFFFF; static const VFS_LONG VFS_INVALID_LONG_VALUE = -1; #define VFS_INVALID_POINTER_VALUE NULL // The File_Open/Create() Flags. enum VFS_OpenFlags{ VFS_READ = 0x0001, VFS_WRITE = 0x0002 }; // The File_Seek() Origin. enum VFS_SeekOrigin{ VFS_SET, VFS_CURRENT, VFS_END }; // The Error Constants. enum VFS_ErrorCode{ VFS_ERROR_NONE, VFS_ERROR_NOT_INITIALIZED_YET, VFS_ERROR_ALREADY_INITIALIZED, VFS_ERROR_ALREADY_EXISTS, VFS_ERROR_NOT_FOUND, VFS_ERROR_INVALID_PARAMETER, VFS_ERROR_GENERIC, VFS_ERROR_INVALID_ERROR_CODE, VFS_ERROR_NO_ROOT_PATHS_DEFINED, VFS_ERROR_PERMISSION_DENIED, VFS_ERROR_IN_USE, VFS_ERROR_CANT_MANIPULATE_ARCHIVES, VFS_ERROR_NOT_AN_ARCHIVE, VFS_ERROR_INVALID_ARCHIVE_FORMAT, VFS_ERROR_MISSING_FILTERS, VFS_NUM_ERRORS }; // The Type of an Entity enum VFS_EntityType{ VFS_FILE, VFS_DIR, VFS_ARCHIVE }; // The Filter Reader and Writer Procedures. typedef VFS_BOOL ( *VFS_FilterReadProc )( VFS_BYTE* pBuffer, VFS_DWORD dwBytesToRead, VFS_DWORD* pBytesRead = NULL ); typedef VFS_BOOL ( *VFS_FilterWriteProc )( const VFS_BYTE* pBuffer, VFS_DWORD dwBytesToWrite, VFS_DWORD* pBytesWritten = NULL ); // An Iteration Procedure (return VFS_FALSE to cancel Iteration). typedef VFS_BOOL ( *VFS_DirIterationProc )( const struct VFS_EntityInfo& Info, void* pParam ); // A List of Filter Names. typedef std::vector< const class VFS_Filter* > VFS_FilterList; typedef std::vector< VFS_String > VFS_FilterNameList; typedef std::vector< VFS_String > VFS_RootPathList; typedef std::vector< struct VFS_EntityInfo > VFS_EntityInfoList; typedef std::map< VFS_String, VFS_String > VFS_FileNameMap; //============================================================================ // INTERFACE COMPONENT HEADERS //============================================================================ //============================================================================ // INTERFACE CLASS PROTOTYPES / EXTERNAL CLASS REFERENCES //============================================================================ //============================================================================ // INTERFACE STRUCTURES / UTILITY CLASSES //============================================================================ // A Filter for the VFS. class VFS_Filter { public: // Constructor / Destructor. VFS_Filter() {} virtual ~VFS_Filter() {} // Encoding / Decoding Procedures. virtual VFS_BOOL Encode( VFS_FilterReadProc Reader, VFS_FilterWriteProc Writer, const struct VFS_EntityInfo& DecodedInfo ) const = 0; virtual VFS_BOOL Decode( VFS_FilterReadProc Reader, VFS_FilterWriteProc Writer, const struct VFS_EntityInfo& EncodedInfo ) const = 0; // Filter Configuration Data Management. virtual VFS_BOOL LoadConfigData( VFS_FilterReadProc Reader ) = 0; virtual VFS_BOOL SaveConfigData( VFS_FilterWriteProc Writer ) const = 0; virtual VFS_DWORD GetConfigDataSize() const = 0; // Information. virtual VFS_PCSTR GetName() const = 0; virtual VFS_PCSTR GetDescription() const = 0; }; // Information about a VFS Entity. struct VFS_EntityInfo{ // The Entity Type. VFS_EntityType eType; // Is the Entity archived (Archive files are NEVER archived)? VFS_BOOL bArchived; // The complete Path (including the Name) and the Name. VFS_String strPath; VFS_String strName; // The Size ( 0 for Directories ). VFS_LONG lSize; }; //============================================================================ // INTERFACE DATA DECLARATIONS //============================================================================ //============================================================================ // INTERFACE FUNCTION PROTOTYPES //============================================================================ /////////////////////////////////////////////////////////////////////////////// // Basic VFS Interface (the error handling functions and the VFS_GetVersion() function may be called even if the VFS isn't initialized yet. The VFS_GetErrorString() function returns the string associated with VFS_ERROR_INVALID_ERROR_CODE if the parameter eError is invalid. You can't get Information about Archives using the VFS_GetEntityInfo() structure because it will report information about the virtual Directory the Archive represents instead). /////////////////////////////////////////////////////////////////////////////// // Initialize / Shutdown the VFS. VFS_BOOL VFS_Init(); VFS_BOOL VFS_Shutdown(); VFS_BOOL VFS_IsInit(); // Register / Unregister a Filter. VFS_BOOL VFS_RegisterFilter( VFS_Filter* pFilter ); VFS_BOOL VFS_UnregisterFilter( VFS_Filter* pFilter ); VFS_BOOL VFS_UnregisterFilter( VFS_DWORD dwIndex ); VFS_BOOL VFS_UnregisterFilter( const VFS_String& strFilterName ); VFS_BOOL VFS_ExistsFilter( const VFS_String& strFilterName ); const VFS_Filter *VFS_GetFilter( const VFS_String& strFilterName ); VFS_DWORD VFS_GetNumFilters(); const VFS_Filter* VFS_GetFilter( VFS_DWORD dwIndex ); VFS_BOOL VFS_GetFilters( VFS_FilterList& Filters ); VFS_BOOL VFS_GetFilterNames( VFS_FilterNameList& FilterNames ); // Root Path Handling. VFS_BOOL VFS_AddRootPath( const VFS_String& strRootPath ); VFS_BOOL VFS_RemoveRootPath( const VFS_String& strRootPath ); VFS_BOOL VFS_RemoveRootPath( VFS_DWORD dwIndex ); VFS_DWORD VFS_GetNumRootPaths(); VFS_BOOL VFS_GetRootPath( VFS_DWORD dwIndex, VFS_String& strRootPath ); VFS_BOOL VFS_GetRootPaths( VFS_RootPathList& RootPaths ); // Flush the VFS (close all unused Archives etc). VFS_BOOL VFS_Flush(); // Information. VFS_BOOL VFS_ExistsEntity( const VFS_String& strPath ); VFS_BOOL VFS_GetEntityInfo( const VFS_String& strPath, VFS_EntityInfo& Info ); VFS_WORD VFS_GetVersion(); // Error Handling. VFS_ErrorCode VFS_GetLastError(); VFS_PCSTR VFS_GetErrorString( VFS_ErrorCode eError ); /////////////////////////////////////////////////////////////////////////////// // The File Interface (the file interface will try to create a file in each root path. If no root path has been added, the current directory will be used instead. You can't manipulate Archive Files.). /////////////////////////////////////////////////////////////////////////////// // Create / Open / Close a File. VFS_Handle VFS_File_Create( const VFS_String& strFileName, VFS_DWORD dwFlags ); VFS_Handle VFS_File_Open( const VFS_String& strFileName, VFS_DWORD dwFlags ); VFS_BOOL VFS_File_Close( VFS_Handle hFile ); // Read / Write from / to the File. VFS_BOOL VFS_File_Read( VFS_Handle hFile, VFS_BYTE* pBuffer, VFS_DWORD dwToRead, VFS_DWORD* pRead = NULL ); VFS_BOOL VFS_File_Write( VFS_Handle hFile, const VFS_BYTE* pBuffer, VFS_DWORD dwToWrite, VFS_DWORD* pWritten = NULL ); // Direct File Reading / Writing. VFS_BOOL VFS_File_ReadEntireFile( const VFS_String& strFileName, VFS_BYTE* pBuffer, VFS_DWORD dwToRead = VFS_INVALID_DWORD_VALUE, VFS_DWORD* pRead = NULL ); VFS_BOOL VFS_File_WriteEntireFile( const VFS_String& strFileName, const VFS_BYTE* pBuffer, VFS_DWORD dwToWrite, VFS_DWORD* pWritten = NULL ); // Positioning. VFS_BOOL VFS_File_Seek( VFS_Handle hFile, VFS_LONG lPosition, VFS_SeekOrigin eOrigin = VFS_SET ); VFS_LONG VFS_File_Tell( VFS_Handle hFile ); // Sizing. VFS_BOOL VFS_File_Resize( VFS_Handle hFile, VFS_LONG lSize ); VFS_LONG VFS_File_GetSize( VFS_Handle hFile ); // Information. VFS_BOOL VFS_File_Exists( const VFS_String& strFileName ); VFS_BOOL VFS_File_GetInfo( const VFS_String& strFileName, VFS_EntityInfo& Info ); VFS_BOOL VFS_File_GetInfo( VFS_Handle hFile, VFS_EntityInfo& Info ); // File Management. VFS_BOOL VFS_File_Delete( const VFS_String& strFileName ); VFS_BOOL VFS_File_Copy( const VFS_String& strFrom, const VFS_String& strTo ); VFS_BOOL VFS_File_Move( const VFS_String& strFrom, const VFS_String& strTo ); VFS_BOOL VFS_File_Rename( const VFS_String& strFrom, const VFS_String& strTo ); // pszTo has to be a single File Name without a Path. /////////////////////////////////////////////////////////////////////////////// // The Archive Interface (Never provide a extension for the archive, instead, change the VFS_ARCHIVE_EXTENSION definition and recompile; You can only create archives in the first root path. You can't manipulate Archives. Each entry VFS_FileNameMap consists of the source file name and the file name in the archive, for instance "alpha/beta/gamma.txt" => "abg.txt"). /////////////////////////////////////////////////////////////////////////////// // Create an Archive. VFS_BOOL VFS_Archive_CreateFromDirectory( const VFS_String& strArchiveFileName, const VFS_String& strDirName, const VFS_FilterNameList& UsedFilters = VFS_FilterNameList(), VFS_BOOL bRecursive = VFS_TRUE ); VFS_BOOL VFS_Archive_CreateFromFileList( const VFS_String& strArchiveFileName, const VFS_FileNameMap& Files, const VFS_FilterNameList& UsedFilters = VFS_FilterNameList() ); // Extract an Archive / File. VFS_BOOL VFS_Archive_Extract( const VFS_String& strArchiveFileName, const VFS_String& strTargetDir ); VFS_BOOL VFS_Archive_ExtractFile( const VFS_String& strArchiveFileName, const VFS_String& strFile, const VFS_String& strTargetFile ); // Information. VFS_BOOL VFS_Archive_Exists( const VFS_String& strArchiveFileName ); VFS_BOOL VFS_Archive_GetInfo( const VFS_String& strArchiveFileName, VFS_EntityInfo& Info ); VFS_BOOL VFS_Archive_GetUsedFilters( const VFS_String& strArchiveFileName, VFS_FilterNameList& FilterNames ); // Archive Management. VFS_BOOL VFS_Archive_Delete( const VFS_String& strArchiveFileName ); // Flush the Archive System. VFS_BOOL VFS_Archive_Flush(); /////////////////////////////////////////////////////////////////////////////// // The Directory Interface (You can only create/delete standard directories in the first root path. You can't manipulate Dirs in Archives). /////////////////////////////////////////////////////////////////////////////// // Directory Management. VFS_BOOL VFS_Dir_Create( const VFS_String& strDirName, VFS_BOOL bRecursive = VFS_FALSE ); // Recursive mode would create a directory c:\alpha\beta even if alpha doesn't exist. VFS_BOOL VFS_Dir_Delete( const VFS_String& strDirName, VFS_BOOL bRecursive = VFS_FALSE ); // Recursive mode would delete a directory c:\alpha even if it contains files and/or subdirectories. // Information. VFS_BOOL VFS_Dir_Exists( const VFS_String& strDirName ); VFS_BOOL VFS_Dir_GetInfo( const VFS_String& strDirName, VFS_EntityInfo& Info ); // Iterate a Directory and call the iteration procedure for each VFS_BOOL VFS_Dir_Iterate( const VFS_String& strDirName, VFS_DirIterationProc pIterationProc, VFS_BOOL bRecursive = VFS_FALSE, void* pParam = NULL ); // Get the Contents of a Directory. VFS_BOOL VFS_Dir_GetContents( const VFS_String& strDirName, VFS_EntityInfoList& EntityInfoList, VFS_BOOL bRecursive = VFS_FALSE ); /////////////////////////////////////////////////////////////////////////////// // The Utility Interface (You may call the File Name Management Functions even if the VFS isn't initialized yet). /////////////////////////////////////////////////////////////////////////////// // File Name Management Functions. VFS_BOOL VFS_Util_GetPath( const VFS_String& strFileName, VFS_String& strPath ); VFS_BOOL VFS_Util_GetName( const VFS_String& strFileName, VFS_String& strName ); VFS_BOOL VFS_Util_GetBaseName( const VFS_String& strFileName, VFS_String& strBaseName ); VFS_BOOL VFS_Util_GetExtension( const VFS_String& strFileName, VFS_String& strExtension ); VFS_BOOL VFS_Util_IsAbsoluteFileName( const VFS_String& strFileName ); //============================================================================ // INTERFACE OBJECT CLASS DEFINITIONS //============================================================================ //============================================================================ // INTERFACE TRAILING HEADERS //============================================================================ #endif // __VFS_H__
-
Du müsstest auch den Quellcode ändern und die *.lib neu erstellen.
-
Big Brother schrieb:
Du müsstest auch den Quellcode ändern und die *.lib neu erstellen.
naja gut den Quellcode hab ich ja, wie ist z.B. der Aufruf folgender Teile umzuschreiben:
typedef std::vector< const class VFS_Filter* > VFS_FilterList; typedef std::vector< VFS_String > VFS_FilterNameList; typedef std::vector< VFS_String > VFS_RootPathList; typedef std::vector< struct VFS_EntityInfo > VFS_EntityInfoList; typedef std::map< VFS_String, VFS_String > VFS_FileNameMap;und
class VFS_Filter { public: // Constructor / Destructor. VFS_Filter() {} virtual ~VFS_Filter() {} // Encoding / Decoding Procedures. virtual VFS_BOOL Encode( VFS_FilterReadProc Reader, VFS_FilterWriteProc Writer, const struct VFS_EntityInfo& DecodedInfo ) const = 0; virtual VFS_BOOL Decode( VFS_FilterReadProc Reader, VFS_FilterWriteProc Writer, const struct VFS_EntityInfo& EncodedInfo ) const = 0; // Filter Configuration Data Management. virtual VFS_BOOL LoadConfigData( VFS_FilterReadProc Reader ) = 0; virtual VFS_BOOL SaveConfigData( VFS_FilterWriteProc Writer ) const = 0; virtual VFS_DWORD GetConfigDataSize() const = 0; // Information. virtual VFS_PCSTR GetName() const = 0; virtual VFS_PCSTR GetDescription() const = 0; };so wie es aussieht sind das die einzigen Teile in dieser Headerdatei die umzuschreiben sind? Die andere Headerdatei ist dann schon etwas komplizierter
-
Wozu der Aufwand, benutz doch nen C++ Compiler, dann brauchst du gar nichts umzuschreiben. Oder nimm ne Ansi C lib.
Gruß,
B.B.