This may not be the source of your issue....But I think you're getting some stuff mixed up with Open/ReadLine and ReadProfileString functions. You don't have to do the filehandle, and Open stuff to use ReadProfileString.