• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 340
  • Last Modified:

EOF - easy question

IS EOF a keyword?  I have an INI file that has text in it.  At the end of the file is an EOF.  The code uses the While Not EOF.   Heres what the file looks like now:

text here
text here
text here

EOF

I need to change this file to this:

text here
text here
text here

EOC

More Text
More Text

EOF

So in the code....can I just say...While Not EOC?  Or is EOF a keyword????   Otherwise I think I could just parse the string.

Thanks,

saki

0
sakibomber
Asked:
sakibomber
1 Solution
 
kafzaalCommented:
if you are reading the file then the you must have used
line input #1,abc

it means that the abc variable will store the value of line and then you have to check the loop as
while not abc = "EOF"
or whatever you want

kashif
0
 
HelixDaKatCommented:
EOF when read from the INI file is NOT a keyword, but a String. "EOF"  

EOF in code IS a Keyword:  EOF(1)

So if your looking for this line when looping through the file you would just put:  (If your using Line Input)

Line Input #1,strLine

if strline = "EOF" then
    'Do something
else
    'Do something else
end if
0
 
AndySulzCommented:
eof stands for "End of File"
0
 
PNJCommented:
Interesting that the words "INI file" were used. In which case you really should be using GetPrivateProfileString to get the values. You then don't read the file at all but use:

Function GetIniData(sSection As String, sEntry As String) As String
   Dim sIniData as String, nTemp as Integer
   sIniData = String$(128, 0)
   nTemp = GetPrivateProfileString(sSection, sEntry, "DEFAULT IF NOT FOUND", sIniData, 127, apIniFile)
   GetIniData = Trim$(Left$(sIniData, nTemp))
End Function

See (eg) WIN.INI for the format.
[Section]
Entry=your value here

Use WritePrivateProfileString to put/overwrite values.
(Using the Windows Registry is better - but harder to use)
0
 
sakibomberAuthor Commented:
thanks :)
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now