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 

reading a file line at a time? and strtok()

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



Joined: 11 Dec 2005
Posts: 121

PostPosted: Tue May 16, 2006 5:06 am    Post subject: reading a file line at a time? and strtok() Reply with quote

Hey i just decided to start deving for the psp aswell now and i am having difficulties... Is there anyway i can read line line at a time from a file? l am also having dificulty using strtok(). the compiler wont recognise it it throws out the undefined reference to "strtok"error, oh and i have included string.h
Back to top
View user's profile Send private message
Gary13579



Joined: 15 Aug 2005
Posts: 93

PostPosted: Tue May 16, 2006 1:17 pm    Post subject: Reply with quote

typing in "man fgets" in bash should solve the first problem.
If you use the sceIo* functions, it will be a bit harder. You could read the file in a few bits at a time and check them to see if a \n is found, or you could read in the entire file and then loop through it and do something everytime a \n is found.

No clue what strtok is, so I can't help you there.
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Tue May 16, 2006 1:52 pm    Post subject: Reply with quote

char *strtok( char *str1, const char *str2 );
found in string.h has he said above :P

basically what it does is break the string in *str1
into substrings (tokens ;) delimited by any of the
characters found in *str2
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
JorDy



Joined: 11 Dec 2005
Posts: 121

PostPosted: Tue May 16, 2006 5:19 pm    Post subject: Reply with quote

yeah i know what it does thatnks fr the help
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 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