9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-09 15:03:37 +01:00
qp2/src/utils/c_funcs.c

41 lines
754 B
C
Raw Normal View History

2019-07-09 17:33:44 +02:00
#include <unistd.h>
2021-03-31 13:33:06 +02:00
#include <stdio.h>
#include <string.h>
2019-07-09 17:33:44 +02:00
void usleep_c(int s)
{
usleep((useconds_t) s);
}
2021-03-31 13:33:06 +02:00
void sscanf_ssds_c(const char* str, char* s1, char* s2, int* i, char* s3)
{
sscanf(str, "%s %s %d %s", s1, s2, i, s3);
s1[strlen(s1)] = ' ';
s2[strlen(s2)] = ' ';
s3[strlen(s3)] = ' ';
}
void sscanf_dd_c(const char* str, int* i1, int* i2)
{
sscanf(str, "%d %d", i1, i2);
}
void sscanf_ddd_c(const char* str, int* i1, int* i2, int* i3)
{
sscanf(str, "%d %d %d", i1, i2, i3);
}
void sscanf_ss_c(const char* str, char* s1, char* s2)
{
sscanf(str, "%s %s", s1, s2);
s1[strlen(s1)] = ' ';
s2[strlen(s2)] = ' ';
}
void sscanf_sd_c(const char* str, char* s1, int* i)
{
sscanf(str, "%s %d", s1, i);
s1[strlen(s1)] = ' ';
}