Created read method on MString to read from sockets.
This commit is contained in:
parent
cca957b948
commit
7341d26852
@ -6,6 +6,8 @@
|
|||||||
#include <format>
|
#include <format>
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
|
||||||
namespace coreutils {
|
namespace coreutils {
|
||||||
|
|
||||||
@ -247,6 +249,13 @@ namespace coreutils {
|
|||||||
}
|
}
|
||||||
length = size;
|
length = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MString &MString::read(int fd) {
|
||||||
|
char ch;
|
||||||
|
while(::read(fd, &ch, 1))
|
||||||
|
write(ch);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
int MString::offset() {
|
int MString::offset() {
|
||||||
return cursor - data;
|
return cursor - data;
|
||||||
|
@ -213,6 +213,12 @@ namespace coreutils {
|
|||||||
///
|
///
|
||||||
|
|
||||||
MString &write(ZString &value);
|
MString &write(ZString &value);
|
||||||
|
|
||||||
|
///
|
||||||
|
/// Read data from a socket and store in MString.
|
||||||
|
///
|
||||||
|
|
||||||
|
MString &read(int fd);
|
||||||
|
|
||||||
int offset();
|
int offset();
|
||||||
|
|
||||||
|
2
compile
2
compile
@ -5,7 +5,7 @@ do
|
|||||||
filename="${file%.*}"
|
filename="${file%.*}"
|
||||||
list="$list $filename.o"
|
list="$list $filename.o"
|
||||||
echo -n "Compiling $filename..."
|
echo -n "Compiling $filename..."
|
||||||
g++ -g -c $file -std=c++20 &
|
g++ -g -c $file -std=c++23 &
|
||||||
if [ $? = '0' ]
|
if [ $? = '0' ]
|
||||||
then
|
then
|
||||||
echo "OK"
|
echo "OK"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user