Is there any way to convert an array to string where each element can be access directly like in MEMOREAD function when it reads file you can access each line in file easily by MEMOLINE function .to simplified my question i want to do the following :
On Tuesday, June 29, 2021 at 3:57:02 PM UTC, rodrego sandino wrote:
Is there any way to convert an array to string where eachMEMOLINE function .
element can be access directly like in MEMOREAD function
when it reads file you can access each line in file easily by
Is there any way to convert an array to string where each element can be access directly like in MEMOREAD function when it reads file you can access each line in file easily by MEMOLINE function .
Il 29/06/2021 17:57, rodrego sandino ha scritto:Thank you very much for your precious answer my dear brother i had implement your nice code but unfortunately it could not reconstruct the image file i have read it with MEMOREAD function and i put it in an array and i follow your code but the image
Is there any way to convert an array to string where each element can be access directly like in MEMOREAD function when it reads file you can access each line in file easily by MEMOLINE function .
aStrings:={"one","two","three"}
with a codeblock:
cString:=""
ascan(aStrings,{|x|cstring+=x+hb_eol()}) // hb_osNewLine in xHarbour
? cString
or with a function:
cString:=a2s(aStrings)
? CSTRING
func a2s(aArr)
local cRes:="",t
for t:=1 to len(aArr)
cRes=cRes+rtrim(aArr[t])+hb_eol() // hb_OsNewLine xHb","
next t
return cRes
Dear sandin...:to know "position"?
On Tuesday, June 29, 2021 at 12:26:37 PM UTC-7, sandin...@gmail.com wrote:
On Tuesday, June 29, 2021 at 3:57:02 PM UTC, rodrego sandino wrote:What do you know about the data type of the elements in the array? What do you know about the dimensonality of the arrays, as in how many parameters there are (uArray(1,2,3,4,5) := codestring)? If more than one dimension (row AND column), do you need
Is there any way to convert an array to string where eachMEMOLINE function .
element can be access directly like in MEMOREAD function
when it reads file you can access each line in file easily by
I'd use this as a template: https://github.com/harbour/core/blob/master/tests/foreach.prgThe data type in array is string and array is single dimension array
David A. Smith
Thank you very much for your precious answer my dear brother i had implement your nice code but unfortunately it could not reconstruct the image file i have read it with MEMOREAD function and i put it in an array and i follow your code but the imagecould not be built again my code is as follow so please advice me what should i do :
Il 30/06/2021 22:29, rodrego sandino ha scritto:could not be built again my code is as follow so please advice me what should i do :
Thank you very much for your precious answer my dear brother i had implement your nice code but unfortunately it could not reconstruct the image file i have read it with MEMOREAD function and i put it in an array and i follow your code but the image
Your approach is completely wrong, sorry. You are trying to read a jpgThank you very much for your nice answer my dear brother ,so how i can reconstruct the image after i read with FRead() function as you saied?
image as a text with memoread(), this can't work.
Back to basics: memoread() reads text files.
A text file contains a limited range of bytes, used to store text,
usually in lines separated by a EOL, so that lines of text can be
counted and extracted.
A jpeg file is called a "binary" file. It contains raw bytes intended to
be interpreted differently than a text file. No EOL separes no lines. To read such a file you should use Fread().
What are you trying to do exactly?
Dan
On Saturday, July 3, 2021 at 7:39:16 AM UTC, Daniele wrote:image could not be built again my code is as follow so please advice me what should i do :
Il 30/06/2021 22:29, rodrego sandino ha scritto:
Thank you very much for your precious answer my dear brother i had implement your nice code but unfortunately it could not reconstruct the image file i have read it with MEMOREAD function and i put it in an array and i follow your code but the
Your approach is completely wrong, sorry. You are trying to read a jpg image as a text with memoread(), this can't work.
Back to basics: memoread() reads text files.
A text file contains a limited range of bytes, used to store text,
usually in lines separated by a EOL, so that lines of text can be
counted and extracted.
A jpeg file is called a "binary" file. It contains raw bytes intended to be interpreted differently than a text file. No EOL separes no lines. To read such a file you should use Fread().
What are you trying to do exactly?
DanThank you very much for your nice answer my dear brother ,so how i can reconstruct the image after i read with FRead() function as you saied?
I had reconstruct the image as you said by using FRead and Fwrite .it works
but i want to ask you question as you said before that MEMOREAD and MEMOWRITE are used to read text files only but i have used them to read image files before and it works by reading the image with MEMOREAD to string and read string again to file and
"... but when i put the string in an array and try to reconstruct the string again in order to rebuild the image again it fails that is why i ask in the beginning how to convert an array of string to a single string..."
In xHarbour the Array IS NOT implemented as in C or C++ the "dense array", and strings cannot include the NULL character (most of the time the blob objects are including NULL characters).
The right way to work with image, sound, video etc. files is to handle them as blob objects when reading from or writing into a local file.
Sending or receiving them over https is a different subject matter.
"... but when i put the string in an array and try to reconstruct the string again in order to rebuild the image again it fails that is why i ask in the beginning how to convert an array of string to a single string..."ok..... how can i make blob object in xharbour ?and how i deal with them? please can you explain that with example?
In xHarbour the Array IS NOT implemented as in C or C++ the "dense array", and strings cannot include the NULL character (most of the time the blob objects are including NULL characters).
The right way to work with image, sound, video etc. files is to handle them as blob objects when reading from or writing into a local file.
Sending or receiving them over https is a different subject matter.
Il 05/07/2021 23:21, Ella Stern ha scritto:can you explain that with simple example? so the i can understand it easly
"... but when i put the string in an array and try to reconstruct the string again in order to rebuild the image again it fails that is why i ask in the beginning how to convert an array of string to a single string..."
In xHarbour the Array IS NOT implemented as in C or C++ the "dense array", and strings cannot include the NULL character (most of the time the blob objects are including NULL characters).
The right way to work with image, sound, video etc. files is to handle them as blob objects when reading from or writing into a local file.
Sending or receiving them over https is a different subject matter.
To answer the OP, it would be possible then to use hb_Base64Encode() to
fill the array with "chunks" of the original file encoded as pure ASCII.
To reconstruct the file every line of the array will be decoded with hb_Base64Decode().
Dan
Il 05/07/2021 23:21, Ella Stern ha scritto:Thank you very much my dear brother it works ....you help me a lot...thank you very much.
"... but when i put the string in an array and try to reconstruct the string again in order to rebuild the image again it fails that is why i ask in the beginning how to convert an array of string to a single string..."
In xHarbour the Array IS NOT implemented as in C or C++ the "dense array", and strings cannot include the NULL character (most of the time the blob objects are including NULL characters).
The right way to work with image, sound, video etc. files is to handle them as blob objects when reading from or writing into a local file.
Sending or receiving them over https is a different subject matter.
To answer the OP, it would be possible then to use hb_Base64Encode() to
fill the array with "chunks" of the original file encoded as pure ASCII.
To reconstruct the file every line of the array will be decoded with hb_Base64Decode().
Dan
how i can convert text file to PDF file in xHarbour ?
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 251 |
Nodes: | 16 (2 / 14) |
Uptime: | 20:47:05 |
Calls: | 5,570 |
Files: | 11,684 |
Messages: | 5,126,976 |