In general, Ampere's law does not necessarily give the value of the magnetic field. It only gives the integral of the field along a closed path. That integral can sometimes be used to deduce the magnetic field at any given point, but only if you know something about the magnetic field from symmetry or other considerations. For example, along a circular path (radius rr) around a long straight wire, symmetry requires that the magnetic field has constant magnitude BB and is always tangent to the path, and so the integral is just BB multiplied by the length of the circular path, which is the circumference 2πr2πr. Then the left-hand side of the Ampere's law equation is B⋅2πrB⋅2πr, and so B=μ0i/2πrB=μ0i/2πr. There are only a couple of other examples of symmetry where Ampere's law is really useful: the ideal solenoid and the toroid.