Added common folder, with a new string helper file.
This commit is contained in:
parent
d68e67e7d7
commit
75575b4a41
2
Makefile
2
Makefile
@ -19,7 +19,7 @@ include $(DEVKITARM)/3ds_rules
|
||||
#---------------------------------------------------------------------------------
|
||||
export TARGET := $(shell basename $(CURDIR))
|
||||
BUILD := build
|
||||
SOURCES := source source/tests source/tests/fs source/tests/cpu
|
||||
SOURCES := source source/common source/tests source/tests/fs source/tests/cpu
|
||||
DATA := data
|
||||
INCLUDES := source #include
|
||||
|
||||
|
25
source/common/string_funcs.cpp
Normal file
25
source/common/string_funcs.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "string_funcs.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
namespace Common {
|
||||
|
||||
std::string FormatString(const char* format, ...)
|
||||
{
|
||||
va_list arguments;
|
||||
char *va_str;
|
||||
|
||||
va_start(arguments, format);
|
||||
vasprintf(&va_str, format, arguments);
|
||||
va_end(arguments);
|
||||
|
||||
std::string out_str(va_str);
|
||||
free(va_str);
|
||||
|
||||
return out_str;
|
||||
}
|
||||
|
||||
}
|
9
source/common/string_funcs.h
Normal file
9
source/common/string_funcs.h
Normal file
@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Common {
|
||||
|
||||
std::string FormatString(const char* format, ...);
|
||||
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
#include <cstring>
|
||||
#include <3ds.h>
|
||||
|
||||
#include "scope_exit.h"
|
||||
#include "common/scope_exit.h"
|
||||
#include "tests/test.h"
|
||||
#include "tests/fs/fs_sdmc.h"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user