Forum Discussion
HKosova
Alumni
14 years agoHi Randy,
aqFile.ReadWholeTextFile actually reads you entire file. For example, if you run:
The issue with cut-off text is caused by the fact that your file contains NULL control characters (characters with code 0). They are usually used to indicate the end of text, that's why, the text after these characters isn't written to the text log or files created with WriteToTextFile.
When you open the file in a text editor and then save it, the editor converts NULL characters to spaces, so that the file contents can be properly processed.
To fix the read text in your TestComplete test in a similar way, you can use the aqString.Replace method to perform the NULL-to-space character replacement:
aqFile.ReadWholeTextFile actually reads you entire file. For example, if you run:
var str = aqFile.ReadWholeTextFile("E:\\aertest.txt", aqFile.ctANSI);
Log.Message(aqString.GetLength(str));you'll get 120071, which is exactly your file size.The issue with cut-off text is caused by the fact that your file contains NULL control characters (characters with code 0). They are usually used to indicate the end of text, that's why, the text after these characters isn't written to the text log or files created with WriteToTextFile.
When you open the file in a text editor and then save it, the editor converts NULL characters to spaces, so that the file contents can be properly processed.
To fix the read text in your TestComplete test in a similar way, you can use the aqString.Replace method to perform the NULL-to-space character replacement:
var str = aqFile.ReadWholeTextFile("E:\\aertest.txt", aqFile.ctANSI);
var str2 = aqString.Replace(str, "\0", " ");