[aklug] Re: Question about C Argument Syntax

From: Piet van Weel <pmvw@outwardfocus.net>
Date: Sat May 16 2009 - 22:12:06 AKDT

It's been a while since I've crafted anything in C...
but I'll give this a try...

So you started out with this...
-----------------------------------------------------------------------
int smvprintw( ? )
{
   // Do various checkson the first two arguments (int y,int x) first,
   // and then
   return mvprintw ( ? );
}
------------------------------------------------------------------------

Plain ole easy way of fixing this... Is taking those inputs and
submitting them into the function.

int y, int x, const char *fmt, ...

------------------------------------------------------------------------

int smvprintw( int y, int x, const char *fmt, ...)
{
   // Do various checkson the first two arguments (int y,int x) first,
   // and then
   return mvprintw (y,x,fmt,...);
}
------------------------------------------------------------------------

There are several other cool methods which involve using void,
and casting them into something else like an int; but that wasn't the question.

Piet van Weel

Christopher Howard wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Quick question for the C gurus among you: I need to write a wrapper
> function around the mvprintw function, like so:
>
> int smvprintw( ? )
> {
> // Do various checks/modifications on the first two arguments (int y,
> int x) first,
> // and then
> return mvprintw ( ? );
> }
>
> How should I write the args for smvprintw so that I can pass all the
> data correctly to mvprintw, and also do my checks on the first two args?
>
> This is mvprintw as listed in the man pages:
> int mvprintw(int y, int x, const char *fmt, ...);
>
> And this is how I saw it in ncurses.h:
> extern NCURSES_EXPORT(int) mvprintw (int,int, const char *,...)
> /* implemented */
>
> - --
> Christopher Howard
> http://indicium.us
> http://theologia.indicium.us
>
> I digitally sign /all/ of my e-mails via PGP. If you receive any e-mails
> supposedly from me without my valid PGP signature, please take
> additional steps to verify the authenticity of the message.
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkoPUvYACgkQQ5FLNdi0BcW/pQCgll0JDNYK8EScpx+plALGiOrj
> +hsAn1rkprxZalqJpNTcxaGleOlFF9Yh
> =xjmh
> -----END PGP SIGNATURE-----
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.
>
>

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.
Received on Sat May 16 22:12:18 2009

This archive was generated by hypermail 2.1.8 : Sat May 16 2009 - 22:12:18 AKDT