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 21, 2010, 12:08:01 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

News: Check out the Code Section!
Home Help Search Shop Login Register
Digg This!
Pages: 1 ... 3 4 [5] 6
Print
Author Topic: [Tutorial] File I/O  (Read 36418 times)
SG57
Sr. Member
****

Karma: +7/-37
Offline Offline

Posts: 474
1140.80 points

View Inventory
Send Money to SG57


View Profile
« Reply #60 on: June 20, 2006, 01:23:02 PM »

harleyg - you didnt back your code up Raphael did, so you dont have any room to talk...

Raphael - yes im young still, (14), so sue me...  Im trying and you have to admit, i made 'some' very good points for my age (?)...  Oh and to follow the 'recommeneded' usage of the libraries prototypes is a well thoguht out strategy becasue it gives you a good habit, where as, as an example, declaring ftell() as an 'int' will only work in those special cases you said already...

Anyway, glad that's all cleared up.
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 #61 on: June 20, 2006, 01:38:55 PM »

Quote
Im trying and you have to admit, i made 'some' very good points for my age

Your really pissing me off now.
Dont ever, ever use your age as a god damn excuse. Got it?
Logged
Raphael
Global Moderator
Hero Member
*

Karma: +228/-10
Offline Offline

Posts: 1416
192907.18 points

View Inventory
Send Money to Raphael


View Profile WWW
« Reply #62 on: June 20, 2006, 02:19:27 PM »

Quote from: "SG57"

Raphael - yes im young still, (14), so sue me...  Im trying and you have to admit, i made 'some' very good points for my age (?)...

I'm not sueing you for being young. Everyone was young once, the only difference is that some understand that their still limited experience and knowledge isn't enough to talk big and play smartass, while the others always try to do exactly that, though most of the time they just make a fool of themself. Unfortunately, you have tendencies to the latter.
Noticing such small inconsistencies to the definitions is a very good attribute for a future programmer and shows potential, but you need to get 100% sure that you're right before shouting 'you made a mistake!', especially if you still make very basic mistakes yourself (like on your other threads here and on PSPU/PS2Dev). That's just some wanna-be attitude, exactly as giving yourself big titles.

Quote

Oh and to follow the 'recommeneded' usage of the libraries prototypes is a well thoguht out strategy becasue it gives you a good habit, where as, as an example, declaring ftell() as an 'int' will only work in those special cases you said already...

Its correct to start from ground up with building a good programming habit for oneself. However, trying to tell others their programming habit is wrong/bad because it differs from your own is a bad social habit.
And these ftell cases aren't that special at all, it's rather the other way around, since we're on a psp-programming forum here.

In the end, it all just comes down to the way how you put down your ideas/criticism. You can try to be constructive and give hints on how to improve things and this will absolutely be accepted and also appreciated. However in your case it just sounded like you were trying to pick upon harleyg and that's something I don't like, and even more so when the picking isn't correct either.

I think you can become a good programmer once, but you need to get rid of your cheeky attitude, or else you won't be accepted by the better programmers, and only from them you can learn and get better yourself.
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 #63 on: June 20, 2006, 02:37:34 PM »

Also...
Quote
harleyg - you didnt back your code up Raphael did, so you dont have any room to talk...

I have every ****ing right to talk.
1. This is my thread.
2. These are my tutorials.
2. You posted comments to me.

Seriously sg, you have issues. Im trying to think back to when you became like this... i have a rough idea but i wont go into it.
Logged
SG57
Sr. Member
****

Karma: +7/-37
Offline Offline

Posts: 474
1140.80 points

View Inventory
Send Money to SG57


View Profile
« Reply #64 on: June 20, 2006, 04:32:36 PM »

harleyg - Seeing as how my age keeps coming up so many times with my programming techniques (I wasn't planning on bringing my age up), I'd say I can use my age as an excuse...

Raphael - I wasn't being a smart ass or anything, I even said to not get mad, but when I looked through and saw some things wrong in the code, I posted what I had seen...  Also, harleyg had said himself that this is 'general' C and yeldarb had just converted it to match PSP Specific I/O Standards to use in the tutorial...  So yes, Id say since this 'thread' is pretty much only General C, ftell()'s return value should be a long, which is important for use on cross-platforms.
Logged
gamehunter101
Full Member
***

Karma: +3/-1
Offline Offline

Posts: 180
0.00 points

View Inventory
Send Money to gamehunter101


View Profile WWW
« Reply #65 on: June 20, 2006, 04:52:18 PM »

Lets just all respect each other and chill alittle Cool  Cool
Logged

Raphael
Global Moderator
Hero Member
*

Karma: +228/-10
Offline Offline

Posts: 1416
192907.18 points

View Inventory
Send Money to Raphael


View Profile WWW
« Reply #66 on: June 20, 2006, 05:23:04 PM »

Quote
ftell()'s return value should be a long, which is important for use on cross-platforms.

Well, technically ok, but it's still not really wrong to cast it to int there, it will only return wrong filesizes/file positions when above 2Gb. I don't think that is something beginners are working with, exactly like cross-plattform compatibility Smile
But I don't wanna argue any more on this, I just wanted to give you my opinion on some of your attitude in the last post.
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 #67 on: June 20, 2006, 10:23:26 PM »

Quote
So yes, Id say since this 'thread' is pretty much only General C


Logged
SG57
Sr. Member
****

Karma: +7/-37
Offline Offline

Posts: 474
1140.80 points

View Inventory
Send Money to SG57


View Profile
« Reply #68 on: June 20, 2006, 10:43:09 PM »

Quote
So yes, Id say since this 'thread' is pretty much only General C, ftell()'s return value should be a long, which is important for use on cross-platforms.
Try again harleyg.

Do you really want to start all this again?
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 #69 on: June 20, 2006, 10:48:24 PM »

Yup i sure do, im a man on a mission.
Logged
Waterbottle
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 34
16.37 points

View Inventory
Send Money to Waterbottle

View Profile
« Reply #70 on: July 04, 2006, 07:32:12 PM »

I'm not sure if I should ask this here..  But I guess it involves fileI/O so I'll do it here:

How can I read what a files timestamp is?
Logged

Waterbottle
Insert_Witty_Name
Global Moderator
Hero Member
*

Karma: +148/-17
Offline Offline

Posts: 1602
1141.66 points

View Inventory
Send Money to Insert_Witty_Name

View Profile WWW
« Reply #71 on: July 05, 2006, 12:20:56 AM »

Quote from: "Waterbottle"
I'm not sure if I should ask this here..  But I guess it involves fileI/O so I'll do it here:

How can I read what a files timestamp is?


I was interested in this too so I gave it a go.

I made an example that worked perfectly on the PC - but gave incorrect date/time on the PSP.

This link contans everything you need to know - plus an example program.

http://cermics.enpc.fr/~ts/C/FUNCTIONS/stat.html

I'm sure it's probably me - I've just got home from a 12 hour night shift, so I could be a little tired  Shocked
Logged

Coder formerly known as:

Check out my homebrew & C tutorials at http://insomniac.0x89.org
Last updated 6th Oct 06 - Tutorial 2 added.
ai3gtmc
main () C & LUA CODER end
Newbie
*

Karma: +10/-47
Offline Offline

Posts: 42
97.39 points

View Inventory
Send Money to ai3gtmc

Hmmm What?


View Profile
« Reply #72 on: April 20, 2007, 09:03:08 PM »

the links for the I/O are down Confused
Logged

gb009
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 7
577.78 points

View Inventory
Send Money to gb009

View Profile
« Reply #73 on: March 03, 2008, 05:06:51 PM »

Hi,

I get the following error when I try to compile the first program in this tutorial:
$gcc main.c
/cygdrive/c/DOCUME~1/gb/LOCALS~1/Temp/ccCFKDIk.o:main.c:(.text+0x6a): undefined reference to '_fseel'
collect2: ld returned 1 exit status



I am posting the code below:
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
   FILE *pFile;
   long lSize;
   char * buffer;

   pFile = fopen("myfile.txt", "rb");

   if(pFile==NULL)
   {
      exit(1);
   }
   fseel(pFile, 0, SEEK_END);
   lSize = ftell(pFile);
   rewind(pFile);

   buffer = (char*) malloc (lSize);
   if(buffer == NULL)
   {
      exit(2);
   }

   fread(buffer,1,lSize,pFile);

   fclose(pFile);

   printf("%s\n", buffer);

   free(buffer);

   return 0;
}


what i am using:
Cygwin with PSPSDK.

command used to compile : gcc main.c

Logged
BigBlack
**PSP-Programmer**
Full Member
***

Karma: +8/-2
Offline Offline

Posts: 109
6867.63 points

View Inventory
Send Money to BigBlack


View Profile WWW
« Reply #74 on: March 03, 2008, 06:28:57 PM »

The Problem is here":
Code:
   fseel(pFile, 0, SEEK_END);
It Should be:
Code:
   fseek(pFile, 0, SEEK_END);

 Very Happy It's an understandable typo.
Logged

Hacked PSP
Formerly Known as 'ttotto'

Hombrew in progress:
PSNP (check out my website)
Going to be added to EZPSP LIb

*EZPSP library*
http://www.psp-programming.com/forums/index.php?topic=2935.

!NEW!
Member kenkai has givin me inspiration to start on rebuilding EZPSP Library!!!!
Pages: 1 ... 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.577 seconds with 37 queries.
Sister Sites: Guitar Hero 4   BrokeniTouch.com