Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
22
Добавлен:
01.05.2014
Размер:
825 б
Скачать
	#ifndef SYMFILE_H	/* This is symfile.h header */

	#define SYMFILE_H

	#include 	"filebase.h"

		/* A class to encapsulate UNIX symbolic link file objects' properties */

	class symfile	:	public filebase 	

	{

		public:

			symfile()		{};
			symfile(const char* fn, int flags, int prot) : filebase(fn,flags,prot)

						{	;	};

			void open( int mode )	{	fstream::open( filename, mode );   }

			int setlink( const char* old_link, const char* new_link)			

						{	filename = new char[strlen(new_link)+1];
							strcpy(filename,new_link);
							return symlink(old_link,new_link);	
						};

			const char* ref_path()	{	static char xbuf[256];

							if (readlink(filename,xbuf,256))

								return xbuf;

							else return (char*)-1;

						};

			};

			#endif	/* symfile.h */
Соседние файлы в папке ch7