mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 01:51:49 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			29 lines
		
	
	
		
			653 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			653 B
		
	
	
	
		
			ObjectPascal
		
	
	
	
	
	
| Program Example62;
 | |
| 
 | |
| { Program to demonstrate the ReadLink function. }
 | |
| 
 | |
| Uses linux;
 | |
| 
 | |
| Var F : Text;
 | |
|     S : String;
 | |
|     
 | |
| begin
 | |
|   Assign (F,'test.txt');
 | |
|   Rewrite (F);
 | |
|   Writeln (F,'This is written to test.txt');
 | |
|   Close(f);
 | |
|   { new.txt and test.txt are now the same file }
 | |
|   if not SymLink ('test.txt','new.txt') then
 | |
|     writeln ('Error when symlinking !');
 | |
|   S:=ReadLink('new.txt');
 | |
|   If S='' then 
 | |
|     Writeln ('Error reading link !')
 | |
|   Else   
 | |
|     Writeln ('Link points to : ',S);
 | |
|  { Now remove links }
 | |
|  If not Unlink ('new.txt') then
 | |
|    Writeln ('Error when unlinking !');
 | |
|  If not Unlink ('test.txt') then
 | |
|    Writeln ('Error when unlinking !');
 | |
| end.
 | 
