Solved

EOF  - easy question

Posted on 2002-06-17
5
285 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

760 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

19 Experts available now in Live!

Get 1:1 Help Now