Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: PowerBuilder
Expertise: Beginner
Apr 16, 1998

Read specific number of chars from file

Question:
I am a rookie at PowerBuilder. I use PB 5, and I can't seem to find a function that reads a specific number of chars from a file into a string. I saw that I can read the whole file into a string, but suppose I want to read five characters from the file. How can I do it? Is it even possible?

Answer:
PowerBuilder's file functions are stream- and line-based. Your only options are to read in a single line (terminated by ~r~n) from a file or up to a maximum of 32,767 characters to the end of the file.

With these two simple functions you can achieve most tasks. If you want the first five characters, then you can use either of the above methods to read in a chunk of data and then just use the Left function to get the characters you want.

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date