Skip to: Site menu | Main content


Welcome to PSP-Programming.com, a place for developers to get together.

Welcome to the forums. Here you can find other user tutorials as well as homebrew releases and the source code repository. You can also ask for help with your code here and post your own homebrew!

PSP-Programming.com Forums
February 10, 2012, 01:46:58 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Join our IRC channel: ##psp-programming on freenode
Home Help Search Shop Login Register
Digg This!
Pages: [1]
Print
Author Topic: need some help text veiwer (should be simple to solve)  (Read 2650 times)
kriogenic
Newbie
*

Karma: +1/-2
Offline Offline

Posts: 35
115.58 points

View Inventory
Send Money to kriogenic

View Profile
« on: October 13, 2006, 06:47:59 AM »

Ok well im not EXACTLY new to C and have made a simple text veiwer so far it is static and loads the one file this is temp till i make a file browsder to go before hand but first off i need help with the following things

[HELP] Where there is a ENTER in text file
[HELP] Scrolling when text file is too large

here is what is up with the enter in text file...

when the app is loaded it uses the fopen command to open the file and then i allocate it some memory then i print it to screen but were ever there was an enter in the text file it comes up with a musical note and i would just go through the text files and add \n but thats a pain when i add the file browser and it isnt static anymore so i need help on fixing that.

and the scrolling thing the text goes off the page and i dont know how to make it scrollable using the D pad so help with this would also be appreciated

Thanks,
Kriogenic.
Logged


swordman
Jr. Member
**

Karma: +5/-1
Offline Offline

Posts: 73
950.11 points

View Inventory
Send Money to swordman

View Profile
« Reply #1 on: October 13, 2006, 08:08:42 AM »

Hi, this thread should help you with the "note symbol"
http://www.psp-programming.com/dev-forum/viewtopic.php?t=1176
For the scrolling, I never done nothing like this, but I think is could be easy impemented drawing only the required line on the screen and, with a variable, keep track of the current line, so if you play down, the number is increased so the firs line dissapear and a new one appear on the bottom.
Logged
kriogenic
Newbie
*

Karma: +1/-2
Offline Offline

Posts: 35
115.58 points

View Inventory
Send Money to kriogenic

View Profile
« Reply #2 on: October 13, 2006, 10:31:23 PM »

swordman thanks for the help i will look at that topic and also try what you said with the variables
Logged
A_Nub
gibbocool rules!
C/C++ Developer
Hero Member
*

Karma: +104/-28
Offline Offline

Posts: 912
3894.18 points

View Inventory
Send Money to A_Nub

Noob am I


View Profile WWW
« Reply #3 on: October 14, 2006, 01:01:39 AM »

any chance on a very simplistic file browser source?
Logged

Code:
      ____________________
 /---/   ---------------   \---\
/   O   |               |   ?   \
| O   O |               | ||  O |
|   O   |_______________|   X   |
\--- (#) () oo PSP oo ()()   ---/
    \-----------------------/
[/CENTER]
InsertWittyName: That's like saying because you wank with your right hank all the time, and one day you wank with your left, that you invented left handed wanking..
harleyg
Give miinaturvat Points!
Full Member
***

Karma: +11/-14
Offline Offline

Posts: 231
0.00 points

View Inventory
Send Money to harleyg

View Profile
« Reply #4 on: October 14, 2006, 01:04:38 AM »

To get scrolling only read a-b amount of lines from the file, when the user press down a++ b++...
Logged
kriogenic
Newbie
*

Karma: +1/-2
Offline Offline

Posts: 35
115.58 points

View Inventory
Send Money to kriogenic

View Profile
« Reply #5 on: October 14, 2006, 02:16:31 AM »

Thanks harleyg that helped alot now i need to work on that file browser if anyone has a simple file browser source that would be good
Logged
kriogenic
Newbie
*

Karma: +1/-2
Offline Offline

Posts: 35
115.58 points

View Inventory
Send Money to kriogenic

View Profile
« Reply #6 on: October 14, 2006, 08:47:00 AM »

one more thing.. Im making it do each letter not line so when i do a++ and b++ it only increases the chars not lines how would i make it do lines? ill post my code up shortly.

EDIT:

and i also am having problems with the (NOTE) problem at the end of each line this it my code

Code:

int main (void) {
     pspDebugScreenInit();
     SetupCallbacks();

   FILE *pFile;
   char buffer[100];
   int fileLen = 0;
   char c = 0;
   int ready = 0;
   int count = 0;
   int i = 0;
   
   pFile = fopen("myfile.txt","r");
   if (!pFile){
      printf("Error. File not opened.\n");
      sceKernelSleepThread();
   }
   // Get File Length
   fseek(pFile,0,SEEK_END);
   fileLen = ftell(pFile);
   fseek(pFile,0,SEEK_SET);

   while(ready == 0){
      i = 0;
      sprintf(buffer," ");
      count = 0;
      while(1){
         c = fgetc(pFile);
         if (c == 0X0D)   //0x0D is the Line Return
            break;
         if (c == EOF){
            ready = 1;
            break;
         }
         if (c != 0x0A){
            buffer[count] = c;
            count = count + 1;
         }
      }
      printf(buffer,"\n");
   }
   fclose(pFile);

     sceKernelSleepThread();
     return 0;
}


im using the myfile.txt because filename is when i get the file browser

my text file looks like this
Code:

This is a text file.
psp-programming.com rules
visit www.onehitgamer.com
for psp hacking!!!
some more text.


and when i run the app on my psp the notes are gone but it now looks like this
Code:

this is a text file.psp-programming.com rulesvisit www.onehitgamer.comfor psp hacking!!!omsome more text.cking!!!om


does anyone know what i am doing wrong cause i have tried many things but cant seem to get it working
Logged
jono
C/C++ Developer
Full Member
*

Karma: +23/-1
Offline Offline

Posts: 210
282.59 points

View Inventory
Send Money to jono


View Profile WWW
« Reply #7 on: October 19, 2006, 07:06:40 PM »

Hi guys, I just posted a file browser source in the Source Code Repository forum, hope it helps.


Jono
Logged

Good grief
A_Nub
gibbocool rules!
C/C++ Developer
Hero Member
*

Karma: +104/-28
Offline Offline

Posts: 912
3894.18 points

View Inventory
Send Money to A_Nub

Noob am I


View Profile WWW
« Reply #8 on: October 20, 2006, 08:15:27 PM »

have it read one line then have it print untill a symbol(that u defined) then have it \n then have it do another printf (yes this is a very noobish way but it should work Mr. Green
Logged

Code:
      ____________________
 /---/   ---------------   \---\
/   O   |               |   ?   \
| O   O |               | ||  O |
|   O   |_______________|   X   |
\--- (#) () oo PSP oo ()()   ---/
    \-----------------------/
[/CENTER]
InsertWittyName: That's like saying because you wank with your right hank all the time, and one day you wank with your left, that you invented left handed wanking..
Zettablade
C/C++ Developer
Full Member
*

Karma: +5/-8
Offline Offline

Posts: 108
2041.97 points

View Inventory
Send Money to Zettablade

Mudkip > You


View Profile
« Reply #9 on: October 20, 2006, 08:23:12 PM »

Mmmmm, I really should learn file i/o. I know a few commands, but not enough to do anything useful. Maybe I'll learn it when I write the skin system for 0x89.
Logged

Pages: [1]
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 1.122 seconds with 34 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com