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

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
JorDy
Posts: 121
Joined: Sun Dec 11, 2005 8:45 am

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

Post by JorDy »

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
Gary13579
Posts: 93
Joined: Mon Aug 15, 2005 7:43 am

Post by Gary13579 »

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.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

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
JorDy
Posts: 121
Joined: Sun Dec 11, 2005 8:45 am

Post by JorDy »

yeah i know what it does thatnks fr the help
Post Reply