forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How-to use tmpfile fonction.

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
Polo35



Joined: 09 Apr 2006
Posts: 25

PostPosted: Sat Jul 08, 2006 1:52 am    Post subject: How-to use tmpfile fonction. Reply with quote

Hello.

I'd like to use the fonction FILE *tmpfile() from stdio, to use a file without having to write one on mc or hdd.

This fonction normaly create a temporary file, which can be use like a normal file open with fopen().

But this fonction always return NULL pointer, in my prog. :(

So, who can explain me how to use this fonction.
With a little example if possible. ;)

Thanks

Best regards

Polo
Back to top
View user's profile Send private message
evilo



Joined: 22 Apr 2004
Posts: 230

PostPosted: Sat Jul 08, 2006 2:04 am    Post subject: Reply with quote

it's normal


Code:


/*
**
**  [func] - tmpfile.
**  [desc] - attempts to create a temporary file. if able to create a temporary
**           file then returns the pointer to the FILE stream. else returns NULL.
**  [entr] - none.
**  [exit] - FILE *; the ptr. to the opened temp. file if successful. else NULL.
**  [prec] - none.
**  [post] - a temporary is opened.
**
*/
FILE *tmpfile(void)
{
  return ((tmpnam(NULL) != NULL) ?  fopen(__stdio_tmpnam, "rw+") : NULL);
}



Code:


/*
**
**  [func] - tmpnam.
**  [desc] - creates a temporary filename string,
**  [entr] - char *name; the pointer to the destination string pointer.
**  [exit] - char *;
**  [prec] -
**  [post] -
**
*/
char *tmpnam(char *name)
{
  char *ret = NULL;

  return (ret);
}



the used function is not fully implemented and always return NULL.

so you know now what to do : contribute to the SDK developement :)
Back to top
View user's profile Send private message Visit poster's website
Polo35



Joined: 09 Apr 2006
Posts: 25

PostPosted: Sat Jul 08, 2006 2:50 am    Post subject: Reply with quote

LOL, MDR. :D

No problem, i'm going to find stdio.c from an other source and to port it.

Best regards

Polo
Back to top
View user's profile Send private message
Polo35



Joined: 09 Apr 2006
Posts: 25

PostPosted: Sat Jul 08, 2006 5:01 pm    Post subject: Reply with quote

Hey.

I found tmpfile stuff in gnu libc source, and the problem is: tmpfile search a dir call tmp in file system, and really create a file.

That's not what i want to do, i want to make a tmp file open only in ram.
Or simulate an opened file.

Does somebody know how to do that?

Best regards

Polo
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group