Changeset e499a30 in mainline for test/print/print1/test.c


Ignore:
Timestamp:
2006-05-02T11:25:22Z (19 years ago)
Author:
Josef Cejka <malyzelenyhnus@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6445baf
Parents:
7dd1787
Message:

All the *printf functions ported to kernel.
Comments updated.
Printf1 test uses snprintf to test printing to a string.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/print/print1/test.c

    r7dd1787 re499a30  
    2929#include <test.h>
    3030
     31#define BUFFER_SIZE 32
     32
    3133void test(void)
    3234{
    3335        __native nat = 0x12345678u;
     36       
     37        unsigned char buffer[BUFFER_SIZE];
     38       
    3439        printf(" Printf test \n");
    3540       
     
    4752       
    4853        printf(" Print to NULL '%s'\n",NULL);
     54
     55        printf("Print short text to %d char long buffer via snprintf.\n", BUFFER_SIZE);
     56        snprintf(buffer, BUFFER_SIZE, "Short %s", "text");
     57        printf("Result is: '%s'\n", buffer);
     58       
     59        printf("Print long text to %d char long buffer via snprintf.\n", BUFFER_SIZE);
     60        snprintf(buffer, BUFFER_SIZE, "Very long %s. This text`s length is more than %d. We are interested in the result.", "text" , BUFFER_SIZE);
     61        printf("Result is: '%s'\n", buffer);
     62       
    4963        return;
    5064}
Note: See TracChangeset for help on using the changeset viewer.