What sort of fastener can I use to stop the squeaks in a carpeted, bedroom floor?

It is possible to silence squeaky floors from above, but no kind of nail will deliver a permanent fix. Your floor was almost certainly built with nails in the first place, and these tend to work loose over time, under the flexing caused by repeated foot traffic. That’s why your floor makes noise. Depending on the style of carpet, deck screws can be used invisibly to draw the subfloor tight to the floor joists, eliminating the gaps that allow movement and noise. In order for this strategy to work, you’ll need to select screws that penetrate at least 1 1/4” into the underlying floor joists, after passing through the 5/8”-thick subfloor. A high quality wall scanner will probably be able to detect the location of floor joists, even through carpet. The centre of each joist is usually located 16” apart in most homes, so when you find one, the others should be easier to find. You’ll know you’ve hit a floor joist because the screw will offer more driving resistance than when it finds empty space underneath the subfloor. If deck screw heads don’t disappear in your carpet, then consider Squeeeeek No More (800-459-8428). They’re screws with snap-off heads made especially for silencing noisy, carpeted floors invisibly.