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
March 13, 2010, 05:44:54 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Welcome to PSP-Programming.com
Home Help Search Shop Login Register
Digg This!
Pages: 1 2 3 [4] 5 6
Print
Author Topic: [Tutorial] File I/O  (Read 36296 times)
Yeldarb
Miinaturvat Rules!
Administrator
Hero Member
*

Karma: +16/-3
Offline Offline

Posts: 602
4160.65 points

View Inventory
Send Money to Yeldarb


View Profile WWW
« Reply #45 on: June 01, 2006, 10:37:36 AM »

PSPU isn't that bad Wink

And yes, traffic is good.  Newbies will generally ignore this site.. unless they're willing to learn to program.
Logged



harleyg
Give miinaturvat Points!
Hero Member
*****

Karma: +11/-14
Offline Offline

Posts: 715
462.95 points

View Inventory
Send Money to harleyg


View Profile
« Reply #46 on: June 01, 2006, 10:39:42 AM »

lol yup... Smile
you should get something to view hits / stats Smile
Logged
harleyg
Give miinaturvat Points!
Hero Member
*****

Karma: +11/-14
Offline Offline

Posts: 715
462.95 points

View Inventory
Send Money to harleyg


View Profile
« Reply #47 on: June 02, 2006, 01:48:11 AM »

kickass... withing a day of being on PSPU, it now has had 1082 views... Smile
Logged
Yeldarb
Miinaturvat Rules!
Administrator
Hero Member
*

Karma: +16/-3
Offline Offline

Posts: 602
4160.65 points

View Inventory
Send Money to Yeldarb


View Profile WWW
« Reply #48 on: June 02, 2006, 05:46:46 AM »

I do have something to view stats, just not a public counter, I think it's tacky :PP
Logged

SG57
Sr. Member
****

Karma: +7/-37
Offline Offline

Posts: 474
1140.80 points

View Inventory
Send Money to SG57


View Profile
« Reply #49 on: June 19, 2006, 04:25:54 PM »

File Input (Reading) - 3. Searching to a certain point.

... i hate to say this harleyg, (cause u hate me enough) but...
ftell() returns a long - you have it as an integer. Why are you casting malloc() ? Why are you stuffing EOF into a char and not an int? Why are you declaring a variable that you don't use (n)? Why isn't there room for the NULL character?
Logged
gamehunter101
Full Member
***

Karma: +3/-1
Offline Offline

Posts: 180
0.00 points

View Inventory
Send Money to gamehunter101


View Profile WWW
« Reply #50 on: June 19, 2006, 04:29:26 PM »

Everyone makes mistakes Wink
Logged

eggwonder
Full Member
***

Karma: +10/-10
Offline Offline

Posts: 181
100681.19 points

View Inventory
Send Money to eggwonder

RAWR


View Profile
« Reply #51 on: June 19, 2006, 04:32:19 PM »

hmmm btw i never thought about it until now but harleyg are you a nazi cause i see a swastica(or however it is spelled) in your sig
Logged

whazilla
Sr. Member
****

Karma: +2/-8
Offline Offline

Posts: 377
1793.33 points

View Inventory
Send Money to whazilla


View Profile
« Reply #52 on: June 19, 2006, 09:38:57 PM »

??? so what ...
u never heard heard of croz of honor

hell
EDIT: for the count ... i could be one to Wink
does that make me less human ?
Logged
harleyg
Give miinaturvat Points!
Hero Member
*****

Karma: +11/-14
Offline Offline

Posts: 715
462.95 points

View Inventory
Send Money to harleyg


View Profile
« Reply #53 on: June 19, 2006, 10:37:15 PM »

SG57, oh well i cant be assed to argue.
eggwonder, nope im not a nazi but 1. i like hitler and agree with what he said and 2. i love the nazi logo Smile
Logged
whazilla
Sr. Member
****

Karma: +2/-8
Offline Offline

Posts: 377
1793.33 points

View Inventory
Send Money to whazilla


View Profile
« Reply #54 on: June 19, 2006, 11:51:41 PM »

u know it is a sign of peace ? ... thruw 3000 years of war ... this sign is always been a peace sign until 50 years ago ...
Logged
SG57
Sr. Member
****

Karma: +7/-37
Offline Offline

Posts: 474
1140.80 points

View Inventory
Send Money to SG57


View Profile
« Reply #55 on: June 20, 2006, 03:56:22 AM »

...hmm... off topic, but does the KKK have a symbol?  Or is it there whitehoods?  

anyway, so is the retro 80s piece sign Smile  it signifys alot of things...
Logged
whazilla
Sr. Member
****

Karma: +2/-8
Offline Offline

Posts: 377
1793.33 points

View Inventory
Send Money to whazilla


View Profile
« Reply #56 on: June 20, 2006, 04:52:46 AM »

i think it's hoodwinked

and oh yeah ... a cross witha circle ... reminds of a playstation symbol :p
Logged
Raphael
Global Moderator
Hero Member
*

Karma: +228/-10
Offline Offline

Posts: 1415
192864.17 points

View Inventory
Send Money to Raphael


View Profile WWW
« Reply #57 on: June 20, 2006, 09:32:36 AM »

Before being picky, better first do some deeper research...
Quote from: "SG57"
File Input (Reading) - 3. Searching to a certain point.

... i hate to say this harleyg, (cause u hate me enough) but...
ftell() returns a long - you have it as an integer.

For the PSP and any 32bit machine, int and long have the same size, so it doesn't matter. If this would be compiled for a 64bit architecture and run on a 64bit OS, it makes only little difference, because only filesizes up to 2Gb will be returned correctly. Well... nothing I would care about in a program where I know how big my files can be.

Quote

Why are you casting malloc() ?

Actually, casting malloc isn't wrong (esp. on PSP, since malloc is correctly returning void*). If you read through your posted thread more closely, you will see that it also has some specific advantages depending on programming style. And the latter is something that everyone has to choose for himself. In fact I cast malloc sometimes myself.

Quote

Why are you stuffing EOF into a char and not an int?

First, the link you give has absolutely nothing to do with the EOF returned by fgetc in C, it references the function eof in the TCL language. In stdio.h EOF is defined as -1, and as such can be held by a char. So this is absolutely legal, though not 100% correct (it could still be the case, though not very likely, that there is character with value -1 (0xff hex) in the file, which will cause the loop to end prematurely).
Also see sample code from http://www.cplusplus.com/ref/cstdio/fgetc.html

Quote

Why are you declaring a variable that you don't use (n)?

This is something that always happens to everyone, when revising one's code, for example when cleaning up for a tutorial or public release. If you would have some more experience, you would know this.

Quote
Why isn't there room for the NULL character?

This one is the only one really important criticism. It would be enough to just set buffer[size-x] = '\0' after the read, but kill the last byte.

Not much left of your criticism in the end.
Logged

Don't push the river, it flows.
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
http://www.homebrew-illuminati.co.uk - serious homebrew development for all platforms
Alexander Berl
"A good mod is a combination playground monitor, priest, big brother/sister, psychiatrist, professor and more."
harleyg
Give miinaturvat Points!
Hero Member
*****

Karma: +11/-14
Offline Offline

Posts: 715
462.95 points

View Inventory
Send Money to harleyg


View Profile
« Reply #58 on: June 20, 2006, 10:05:37 AM »

Thanks Raphael...
SG57 has some issues Wink
Logged
Raphael
Global Moderator
Hero Member
*

Karma: +228/-10
Offline Offline

Posts: 1415
192864.17 points

View Inventory
Send Money to Raphael


View Profile WWW
« Reply #59 on: June 20, 2006, 10:13:58 AM »

Well, he's young and wants to show-off, nothing else. And it works with anyone that has no clue about programming, but I only find myself grining. He has to learn that he's not yet good enough to talk so big.
Logged

Don't push the river, it flows.
http://wordpress.fx-world.org - my devblog
http://wiki.fx-world.org - VFPU documentation wiki
http://www.homebrew-illuminati.co.uk - serious homebrew development for all platforms
Alexander Berl
"A good mod is a combination playground monitor, priest, big brother/sister, psychiatrist, professor and more."
Pages: 1 2 3 [4] 5 6
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 0.728 seconds with 36 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com