CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> CodeCharge.Discussion

 slice a text file

Print topic Send  topic

Author Message
Jon Lau
Posted: 04/30/2002, 9:20 AM

I know this is no place to ask about ASP code.
But,
anyone knows how to read a text file using ASP code and substring the text
at certain interval fixed position of the text.
The text have rows/records of data with fixed column postion.

Regards,

Jon Lau



Sixto Luis Santos
Posted: 04/30/2002, 7:32 PM

Hello,

To open the text file, use the FileSystemObject object:

<%
Set fs=CreateObject("Scripting.FileSystemObject")
Set fsText=fs.OpenTextFile(filename)

' Once open, use ReadLine to read from the file, one line at a time
' of course, you need to do this from the begining to the end of the file
' so we use a loop and check the state of the AtEndOfStream property
'
' ReadLine reads a whole line and increments the line position marker

While not fsText.AtEndOfStream
sLine=fsText.ReadLine

' Ok... sLine now holds the text line, we need to extract the column values
' and we can use the Mid function for this.

value1 = Mid(sLine, position, lenght)

' Do whatever you need to do with the values
' then continue with the next line
Wend

' It is always a good practice to clean after yourself
fsText.Close
Set fsText=Nothing
Set fs=Nothing

%>


Regards,
Sixto

"Jon Lau" <laujon@mbox2.singnet.com.sg> wrote in message
news:aamg8g$guv$1@news.codecharge.com...
> I know this is no place to ask about ASP code.
> But,
> anyone knows how to read a text file using ASP code and substring the text
> at certain interval fixed position of the text.
> The text have rows/records of data with fixed column postion.
>
> Regards,
>
> Jon Lau
>
>
>
>


   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.