readtextfile
This commit is contained in:
1 parent
fcbb1d2941
commit
37967b9f94
13 files changed
+22
-1
No files matched your search
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -151,6 +151,8 @@ void fwritelines(FILE *fp, amsstring *s);
|
||||
void fwritelines(FILE *fp, std::vector<amsstring> *lines);
|
||||
void freadtxtfile(FILE *fp, amsstring *s);
|
||||
|
||||
int readtextfile(const amsstring fname, amsstring *s);
|
||||
|
||||
}; //end namespace ams
|
||||
|
||||
#include <amsstring4/amsstring4_unicode.hpp>
|
||||
|
||||
@@ -1493,6 +1493,25 @@ namespace ams
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int readtextfile(const amsstring fname, amsstring *s)
|
||||
{
|
||||
int ret = 1;
|
||||
FILE *fp = NULL;
|
||||
|
||||
fp = fopen(fname.cstring, "r");
|
||||
if(fp==NULL)
|
||||
{
|
||||
printf("readtextfile: could not open %s for reading.\n",fname.cstring);
|
||||
ret = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
freadtxtfile(fp,s);
|
||||
|
||||
fclose(fp); fp=NULL;
|
||||
return ret;
|
||||
}
|
||||
|
||||
amsstring amsstring::operator+(const amsstring &other)
|
||||
{
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ int main(int argc, char* argv[])
|
||||
amsstring4_test_strip();
|
||||
amsstring4_test_freadwrite();
|
||||
|
||||
amsstring4_test_concatenation_operators(); //segfault on Debian11?
|
||||
amsstring4_test_concatenation_operators();
|
||||
|
||||
return ret;
|
||||
}
|
||||
Reference in new issue
Block a user