forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to read the line in file which u need (little problem)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
Pihas



Joined: 25 Oct 2008
Posts: 60
Location: Lithuania

PostPosted: Wed Oct 29, 2008 9:10 pm    Post subject: How to read the line in file which u need (little problem) Reply with quote

Inside Text document (mydoc.txt):
-- blablabla
blablabla
text 569 text


How to read 3 line from file mydoc.txt and get string from 5 to 8 (569)?

file=io.open("mydoc.txt","r")
numbers = file:read()
file:close()

screen.print(100,100,numbers,white)
Back to top
View user's profile Send private message Visit poster's website
LionX



Joined: 27 Dec 2004
Posts: 61

PostPosted: Thu Jan 29, 2009 3:45 am    Post subject: Reply with quote

to read the 1st line:
read 1 byte at a time until you see a byte=='\n'

'\n' is newline (enter key)



if you want to read each item in the line then you would check for spaces byte==' '
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group