QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

File reading problems (been tweaking for 5 hours!)

This is a discussion on File reading problems (been tweaking for 5 hours!) within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; PHP Code:      while ( fgets ( tempTime , 11 , songPort )!= NULL ) {         if ( fgets ( ...

Reply
 
LinkBack Thread Tools
Old 06-02-2008, 11:23 AM   #1
 
Join Date: Nov 2006
Posts: 10
Trader Feedback: 0
Default File reading problems (been tweaking for 5 hours!)

PHP Code:
    while (fgets(tempTime,11,songPort)!=NULL) {

        if (
fgets(tempButton,4,songPort)!=NULL) {

            
noteTime[arrayCounter]=atof(tempTime);
            
noteButton[arrayCounter]=atoi(tempButton);

        }

printf("noteTime: %.1f\n", noteTime[arrayCounter]);
printf("noteButton: %i\n", noteButton[arrayCounter]);

        
arrayCounter++;

    }
It reads from a file that looks like this:

PHP Code:
.1
2
.3
4
.5
6
0.7
8
0.9
10
and the output is this:
PHP Code:
0.000
2
0.000
4
0.000
6
0.000
8
.9
10
Notice the final float, it shows up? WTH?

Can anybody explain to me why nearly half the values return 0 (zero)? Thanks I've been messing with it for at least 5 hours with no luck.
Palko17 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2008, 11:39 AM   #2

Developer
 
Join Date: Mar 2006
Posts: 1,026
Trader Feedback: 0
Default

Use fscanf().
__________________

Check out my homebrew & C tutorials at http://insomniac.0x89.org/
Coder formerly known as Insomniac197

Quote:
tshirtz: what is irshell ??
Atarian_: it's where people who work for the IRS go when they die
Insert_Witty_Name is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 06-02-2008, 11:51 AM   #3
 
Join Date: Nov 2006
Posts: 10
Trader Feedback: 0
Default

Thanks mane that worked. Thing is I've been staring at that function's documentation all day, I dunno why I never tried it.
Palko17 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
file , hours , problems , reading , tweaking

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 06:04 AM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us