I believe you need to optimize the format of your txt file database. My recommendation is to create a property file, which would store the information as key pairs. You can use the account number as the key and rest of the information as the pair for it. For example:
accountnumber1=Password1&Balance1/
accountnumber2=Password2&Balance2/
accountnumber3=Password3&Balance3/
Using this appraoch, your retrieval will be quick. And you just have to split the values retrieved to get the pieces of the information.
Although i have used properties file in Java conveniently but I have never done so in C. Hence I googled to check whether it is possible to do so. And here are the results:
In this case Google gives (first 4 hits for C config file library):
http://www.hyperrealm.com/libconfig/
http://freshmeat.net/projects/cfl/
Hope it helps!