So basically we'll just say that, for example, the user inputs 'As' and it is set to variable 'A'.
I have an input .txt file that has a list of these characters (it's for figuring out molecular geometry) so somewhere in the text file it says
'Arsenic As 5'
I want to have my program run through the input file, looking for the contents of string 'A,' retrieve the 5, and assign it to another variable, 'v.' How could i go about that?
SumTingWong59
0
Newbie Poster
Recommended Answers
Jump to PostOpen input file. Get each word one at a time. If word == A: Get the next word v = that next word
Jump to PostThe file is not huge (molecules); consider reading the entire file into a data structure in memory. Perform the look ups in memory, and if the data is modified, write it back into the file at the end.
All 5 Replies
Moschops
683
Practically a Master Poster
Featured Poster
vijayan121
1,152
Posting Virtuoso
SumTingWong59
0
Newbie Poster
Moschops
683
Practically a Master Poster
Featured Poster
SumTingWong59
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.