Solved

EOF  - easy question

Posted on 2002-06-17
5
295 Views
Last Modified: 2010-05-02
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
Comment
Question by:sakibomber
5 Comments
 

Expert Comment

by:kafzaal
ID: 7085520
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
 
LVL 1

Expert Comment

by:HelixDaKat
ID: 7085528
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
 
LVL 2

Expert Comment

by:AndySulz
ID: 7087716
eof stands for "End of File"
0
 
LVL 3

Accepted Solution

by:
PNJ earned 50 total points
ID: 7088022
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
 

Author Comment

by:sakibomber
ID: 7091827
thanks :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now