| View previous topic :: View next topic |
| Author |
Message |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Mon Jun 22, 2009 1:13 am Post subject: Question about kernel libc |
|
|
Hi,
I found myself in a need of functions like vsprintf and/or vfprintf in my vsh plugin prx, but those function can't be found in kernel libc.
Is there any chance I could get those functions in kernel libc?
Or are there any other with similar functionality in kernel libc that I could use? _________________ ...sorry for my english... |
|
| Back to top |
|
 |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Mon Jun 22, 2009 5:28 am Post subject: |
|
|
Allright, I found the prnt() function: http://dark-alex.org/pspsdk_docs/pspsysclib_8h.html
How do I use it? Using it via a callback isn't really convenient... :/ oh well... _________________ ...sorry for my english... |
|
| Back to top |
|
 |
sauron_le_noir
Joined: 05 Jul 2008 Posts: 229
|
|
| Back to top |
|
 |
kralyk
Joined: 06 Apr 2008 Posts: 114 Location: Czech Republic, central EU
|
Posted: Mon Jun 22, 2009 6:15 am Post subject: |
|
|
Thank you, but I just resolved the problem using buit in prnt() function
Here goes the code:
| Code: |
#define TEMP_LEN 1024
typedef struct
{
char str[TEMP_LEN];
int idx;
int done;
} prnt_cb_ctx;
void prnt_cb(prnt_cb_ctx * ctx, int ch)
{
if (!ctx || (ch == 0x200)) return;
if ((ctx->idx++) < TEMP_LEN)
{
if (ch != 0x201)
{
ctx->str[ctx->idx] = (char)ch;
} else
{
ctx->str[ctx->idx] = '\0';
ctx->done = 1;
}
} else if (ch == 0x201)
{
ctx->str[TEMP_LEN-1] = '\0';
ctx->done = 1;
}
}
int my_func(int type, char * message, ...)
{
//Some code here...
//(args does get initialised, dont worry)
ctx.idx = -1;
ctx.done = 0;
prnt(&prnt_cb, &ctx, message, args);
while (!ctx.done) sceKernelDelayThreadCB(1000);
written += sceIoWrite(file, ctx.str, strlen(ctx.str));
written += sceIoWrite(file, "\r\n", 2);
sceIoClose(file);
va_end(args);
//Some code here...
}
|
Do you think that delay of 1ms is appropriate? _________________ ...sorry for my english... |
|
| Back to top |
|
 |
slasher2661996
Joined: 22 Feb 2009 Posts: 91 Location: Melbourne Australia ZOMG
|
Posted: Mon Jun 22, 2009 2:49 pm Post subject: |
|
|
| There are no loops, so i would say you don't need it. |
|
| Back to top |
|
 |
Jim

Joined: 02 Jul 2005 Posts: 487 Location: Sydney
|
|
| Back to top |
|
 |
|