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?
Question about kernel libc
Question about kernel libc
...sorry for my english...
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...
How do I use it? Using it via a callback isn't really convenient... :/ oh well...
...sorry for my english...
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
look at this site the code of the printf function
without stdarg
http://www.menie.org/georges/embedded/printf.c
with stdarg
http://www.menie.org/georges/embedded/printf-stdarg.c
without stdarg
http://www.menie.org/georges/embedded/printf.c
with stdarg
http://www.menie.org/georges/embedded/printf-stdarg.c
Thank you, but I just resolved the problem using buit in prnt() function
Here goes the code:
Do you think that delay of 1ms is appropriate?
Here goes the code:
Code: Select all
#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...
}
...sorry for my english...
-
- Posts: 91
- Joined: Sun Feb 22, 2009 8:32 am
- Location: Melbourne Australia ZOMG