librnr  1.14.5
RoadNarrows Robotics Common Library 1
win.c File Reference

Windows functions for linux. More...

#include "rnr/rnrconfig.h"
#include "rnr/new.h"
#include <sys/types.h>
#include <stdio.h>
#include <string.h>

Go to the source code of this file.

Functions

char * strcpy_s (char *dest, size_t n, const char *src)
 Copy source string to destinations string. At most n bytes will be copied. The destination string is guaranteed to be null terminated. More...
 
int sprintf_s (char *str, size_t n, const char *format,...)
 Format print to string up to n-1 characters. String is guaranteed to be null terminated. More...
 

Detailed Description

Windows functions for linux.

LastChangedDate
2010-03-24 10:19:36 -0600 (Wed, 24 Mar 2010)
Rev
307
Author
Robin Knight (robin.nosp@m..kni.nosp@m.ght@r.nosp@m.oadn.nosp@m.arrow.nosp@m.s.co.nosp@m.m)

Definition in file win.c.

Function Documentation

int sprintf_s ( char *  str,
size_t  n,
const char *  format,
  ... 
)

Format print to string up to n-1 characters. String is guaranteed to be null terminated.

Parameters
strDestination string buffer.
nSize of string buffer.
formatStandard printf formatting string.
...Variable argument list.
Returns
Number of characters printed.

Definition at line 83 of file win.c.

Referenced by delete().

84 {
85  va_list ap;
86  int nPrinted;
87 
88  va_start(ap, format);
89  nPrinted = vsnprintf(str, (size_t)n, format, ap);
90  va_end(ap);
91  str[n-1] = 0;
92  return nPrinted;
93 }
char* strcpy_s ( char *  dest,
size_t  n,
const char *  src 
)

Copy source string to destinations string. At most n bytes will be copied. The destination string is guaranteed to be null terminated.

Parameters
destPointer to destination string.
nMaximum number of bytes to copy.
srcPointer to source string.
Returns
Return pointer to destination string.

Definition at line 65 of file win.c.

Referenced by delete().

66 {
67  strncpy(dest, src, (size_t)n);
68  dest[n-1] = 0;
69  return dest;
70 }