Forum Discussion

rani_m215's avatar
rani_m215
Occasional Contributor
14 years ago

Aqfile.writetotextfile is not working in TC-8

I tried doing memory leak test to my application by following memory leak video tutorial but it failed creating file in the mentioned path. So I thought of trying a simple code from the help guide example but got an error in logs.




Sub CreatingAndWritingToTextFile



 If (aqFile.Create("C:\MyFiles\DemoFile.txt") = 0) Then


  Call aqFile.WriteToTextFile("C:\MyFiles\DemoFile.txt", "Hello!", aqFile.ctUTF8)

  Call Log.Message("The file is created and the specified text is written to it successfully.")

 else 

  Call Log.Error("The file was not created.")

 End If


 

End Sub



Please help me how can I create/save a text file for memory leak testing in testcomplete-8



Thanks,


MJP-TC







2 Replies

  • Hi,



    Obtain the result of the aqFile.Create method and pass this result to the aqUtils.SysErrorMessage method. What message soes it return?

    Sub CreatingAndWritingToTextFile

    res = aqFile.Create("C:\MyFiles\DemoFile.txt")

    If (res = 0) Then

    Call aqFile.WriteToTextFile("C:\MyFiles\DemoFile.txt", "Hello!", aqFile.ctUTF8)

    Call Log.Message("The file is created and the specified text is written to it successfully.")

    else

    Call Log.Error("The file was not created. " & aqUtils.SysErrorMessage(res))

    End If



    End Sub

  • rani_m215's avatar
    rani_m215
    Occasional Contributor
    Hi Jared,



    Thank you for your reply.



    It looks like the functionality is working today. I just missed creating file in particular location. Today I added that to the script and it worked fine after that.



    Thanks,

    Jaya