it's been a while, but it should be something like this

Dim strBuff As String

Dim TotalLines As Integer = 0
Dim IncludeLines As Integer = 0


Open "c:\somefile.vbw" For Input As #1
Do Until EOF(1)
   Line Input #1, strBuff

            TotalLines = TotalLines + 1

            If instr(strBuf,"#defines) > 0  Then
                IncludeLines = IncludeLines + 1
            End If

Loop
Close #1


hope this works, it's been 6 years ;-)

with kind regards
Ruben Willems




On Thu, Apr 9, 2009 at 12:10 PM, madhu nambiar <[email protected]>wrote:

> Hi ruben,
>            I am extensively searching a lot but tats not much of a use.Can
> u please help me out in this??
>
> Thanks
> Maddy
> On Thu, Apr 9, 2009 at 2:43 PM, madhu nambiar <[email protected]>wrote:
>
>> Thanks ruben.
>>
>>
>> On Thu, Apr 9, 2009 at 2:34 PM, Ruben Willems <[email protected]>wrote:
>>
>>> ok,
>>>
>>>
>>> than that code won't work, because a vbs file is VB6 syntax
>>> if you google around on working with files VB6
>>> you'll get more usefull hints
>>>
>>>
>>> with kind regards
>>> Ruben Willems
>>>
>>>
>>>
>>>   On Thu, Apr 9, 2009 at 10:44 AM, madhu nambiar <
>>> [email protected]> wrote:
>>>
>>>> its a vbs file
>>>>
>>>> with kind regards
>>>> Maddy
>>>>
>>>>   On Thu, Apr 9, 2009 at 2:12 PM, Ruben Willems <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi
>>>>>
>>>>>
>>>>> are you using VB.Net or vb scipt (a vbs file)
>>>>>
>>>>>
>>>>> with kind regards
>>>>> Ruben Willems
>>>>>
>>>>>
>>>>>   On Thu, Apr 9, 2009 at 10:35 AM, madhu nambiar <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi ruben,
>>>>>>                 Thanks.But i am getting error in the first line of
>>>>>> execution.ie "expected end of statement".
>>>>>>
>>>>>> with regards
>>>>>> Maddy
>>>>>>
>>>>>>   On Thu, Apr 9, 2009 at 1:56 PM, Ruben Willems <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi
>>>>>>>
>>>>>>>
>>>>>>> in vb.net it is :
>>>>>>>
>>>>>>>
>>>>>>>         Dim SourceFile As New IO.StreamReader("d:\temp\data.txt")
>>>>>>>         Dim line As String
>>>>>>>
>>>>>>>         Dim TotalLines As Integer = 0
>>>>>>>         Dim IncludeLines As Integer = 0
>>>>>>>
>>>>>>>
>>>>>>>         While Not SourceFile.EndOfStream
>>>>>>>             line = SourceFile.ReadLine
>>>>>>>
>>>>>>>
>>>>>>>             TotalLines += 1
>>>>>>>
>>>>>>>             If line.Contains("#defines") Then
>>>>>>>                 IncludeLines += 1
>>>>>>>             End If
>>>>>>>
>>>>>>>
>>>>>>>         End While
>>>>>>>
>>>>>>>         SourceFile.Close()
>>>>>>>
>>>>>>>
>>>>>>>         Console.WriteLine("Total Lines {0}", TotalLines)
>>>>>>>         Console.WriteLine("Include Lines {0}", IncludeLines)
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> this should get you started ;-)
>>>>>>>
>>>>>>>
>>>>>>> with kind regards
>>>>>>> Ruben Willems
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>   On Thu, Apr 9, 2009 at 10:17 AM, madhu nambiar <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Hi ruben,
>>>>>>>>
>>>>>>>>      Thanks a lot ruben.I am just trying to count the nuber of
>>>>>>>> #defines as mentioned before using VB scripts.
>>>>>>>> I am really new to it.Can u suggest me how to write it in VB or any
>>>>>>>> other method is also welcome
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>> Maddy
>>>>>>>>
>>>>>>>>   On Thu, Apr 9, 2009 at 12:49 PM, Ruben Willems <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Hi
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> it's your demo ;-)
>>>>>>>>> so make it a worthwhile one for your company
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> with kind regards
>>>>>>>>> Ruben Willems
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>   On Thu, Apr 9, 2009 at 9:01 AM, madhu nambiar <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> hi ruben,
>>>>>>>>>>             Thanks a lot for the idea.I have a another suggestion
>>>>>>>>>> .Instead of counting on the number of comment lines,i just made a 
>>>>>>>>>> slight
>>>>>>>>>> change i which like counting the number of '#define' in my three .c
>>>>>>>>>> files.Will that be ok??
>>>>>>>>>>
>>>>>>>>>> Witk kind regards
>>>>>>>>>> Maddy
>>>>>>>>>>   On Thu, Apr 9, 2009 at 12:17 PM, Ruben Willems <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Hi
>>>>>>>>>>>
>>>>>>>>>>> if the source files are plain text,
>>>>>>>>>>> you could try the following :
>>>>>>>>>>> ° count all lines
>>>>>>>>>>> ° count all comment lines
>>>>>>>>>>> ° if the percentage is lower than X, throw error
>>>>>>>>>>>
>>>>>>>>>>> the counting of the comment lines does not have to be 100%
>>>>>>>>>>> accurate for a demo project ;-)
>>>>>>>>>>>
>>>>>>>>>>> just an idea
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> with kind regards
>>>>>>>>>>> Ruben Willems
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>   On Thu, Apr 9, 2009 at 8:40 AM, madhu nambiar <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi ruben,
>>>>>>>>>>>>       Thanks a lot for this input,but there is one thing i want
>>>>>>>>>>>> to tell.I am doing this for my demo purpose,so i am a bit confused 
>>>>>>>>>>>> in
>>>>>>>>>>>> thinking of what kind of validation check can be performed?.
>>>>>>>>>>>>
>>>>>>>>>>>> with kind regards
>>>>>>>>>>>> Maddy
>>>>>>>>>>>>
>>>>>>>>>>>>   On Thu, Apr 9, 2009 at 11:57 AM, Ruben Willems <
>>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Hi
>>>>>>>>>>>>>
>>>>>>>>>>>>> do you mean the following sequence :
>>>>>>>>>>>>>
>>>>>>>>>>>>> ° get source
>>>>>>>>>>>>> ° do a validation check
>>>>>>>>>>>>> ° if ok, compile, test, ...
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> if so, place your validation check in the < prebuild> section
>>>>>>>>>>>>> There you can put tasks as in the <tasks> section.
>>>>>>>>>>>>>
>>>>>>>>>>>>> If the validation fails, the <tasks> section will not be
>>>>>>>>>>>>> executed, the publisher section will be executed.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> with kind regards
>>>>>>>>>>>>> Ruben Willems
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Thu, Apr 9, 2009 at 8:04 AM, Maddy <[email protected]
>>>>>>>>>>>>> > wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi ,
>>>>>>>>>>>>>>       Can anyone please suggest me any type of validation
>>>>>>>>>>>>>> check that
>>>>>>>>>>>>>> can be performed on any type of build.I mean that this type of
>>>>>>>>>>>>>>  test
>>>>>>>>>>>>>> should be valid for any type of build.I need this test to be
>>>>>>>>>>>>>> performed
>>>>>>>>>>>>>> just before my building process starts.I want to show for me
>>>>>>>>>>>>>> demo
>>>>>>>>>>>>>> purpose.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thanks
>>>>>>>>>>>>>> Maddy
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to