Given a circle $x^2+y^2+2x-4y+1=0 \rightarrow$ centre of the circle $C=(-1,2)$

Given a point $A = (3,0)$, we need to find the length of $AB$ as depicted below:

The radius of the circle is $\sqrt{g^2+f^2-c}$

Radius $r = \sqrt{-1^2+2^2-1} = \sqrt 4 = 2$

Distance from centre of circle to point $A = \sqrt{(3+1)^2+(0-2)^2} = \sqrt{16+4} = \sqrt{20}$

$\Rightarrow$ Using Pythogarous Theorem, we can calculate $AB = \sqrt{AC^2 - BC^2} $

$\Rightarrow AB = \sqrt{\sqrt{20}^2 - 2^2} = \sqrt{20-4} = \sqrt{16} = 4$