Dear Crsitobal,
sometimes when I save text with memowrite() the files are stored as UNIX Type files.
I do not find out where I can change that the files are always DOS Type files.
I think I saw inside your fivedit this possibility. Can you please show me where you can change type format with FW source code?
Best regards,
Otto
memowrit() file type DOS or UNIX
- Otto
- Posts: 6414
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 30 times
- Been thanked: 2 times
- Contact:
memowrit() file type DOS or UNIX
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Antonio Linares
- Site Admin
- Posts: 42599
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 41 times
- Been thanked: 88 times
- Contact:
Re: memowrit() file type DOS or UNIX
Dear Otto,
From google:
The main difference is in the line endings for each. Windows uses CR-LF as the line ending in a text file, while linux uses LF and MacOS uses (used?) CR. The upshot of this is that if you save a script file on Windows it will default to CR-LF which will make the script unable to be executed in Linux.
From google:
The main difference is in the line endings for each. Windows uses CR-LF as the line ending in a text file, while linux uses LF and MacOS uses (used?) CR. The upshot of this is that if you save a script file on Windows it will default to CR-LF which will make the script unable to be executed in Linux.
Re: memowrit() file type DOS or UNIX
Dear Otto
PREFERENCES - GENERAL - Convert and Settings - Set EOL CRLF ( or LF or CR )
PREFERENCES - GENERAL - Convert and Settings - Set EOL CRLF ( or LF or CR )
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
- Otto
- Posts: 6414
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 30 times
- Been thanked: 2 times
- Contact:
Re: memowrit() file type DOS or UNIX
Dear Antonio, dear Cristobal,
Thank you for your help.
As I need this inside my code, do you think strTans() could work?
>Windows uses CR-LF as the line ending in a text file, while linux uses LF
Best regards,
Otto
Thank you for your help.
As I need this inside my code, do you think strTans() could work?
>Windows uses CR-LF as the line ending in a text file, while linux uses LF
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
- Antonio Linares
- Site Admin
- Posts: 42599
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Has thanked: 41 times
- Been thanked: 88 times
- Contact:
Re: memowrit() file type DOS or UNIX
Dear Otto,
You can use StrTran( cText, Chr( 13 ) + Chr( 10 ), Chr( 10 ) ) to go from Windows to Linux
but to go from Linux to Windows I think you can not use StrTran() or you will go into an endless loop as it will never stop:
StrTran( cText, Chr( 10 ), Chr( 13 ) + Chr( 10 ) )
So from Linux to Windows you may do:
local aLines := hb_ATokens( cText, LF )
and then create the text:
cText := ""
AEval( aLines, { | cLine | cText += cLine + CRLF } )
You can use StrTran( cText, Chr( 13 ) + Chr( 10 ), Chr( 10 ) ) to go from Windows to Linux
but to go from Linux to Windows I think you can not use StrTran() or you will go into an endless loop as it will never stop:
StrTran( cText, Chr( 10 ), Chr( 13 ) + Chr( 10 ) )
So from Linux to Windows you may do:
local aLines := hb_ATokens( cText, LF )
and then create the text:
cText := ""
AEval( aLines, { | cLine | cText += cLine + CRLF } )
- Otto
- Posts: 6414
- Joined: Fri Oct 07, 2005 7:07 pm
- Has thanked: 30 times
- Been thanked: 2 times
- Contact:
Re: memowrit() file type DOS or UNIX
Dear Antonio,
Thank you.
As these files are only a few lines, maybe I can
STRTRAN() CRLF to something
then STRTRAN() LF to CRLF
and then something to CRLF.
I will try when I face the next time, a wrong file type.
Best regards,
Otto
Thank you.
As these files are only a few lines, maybe I can
STRTRAN() CRLF to something
then STRTRAN() LF to CRLF
and then something to CRLF.
I will try when I face the next time, a wrong file type.
Best regards,
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
Re: memowrit() file type DOS or UNIX
hi,
i have a "Old" which need CRLF else all is "one line"
i have this working Source which work under Xbase++
it should also run under harbour
i have a "Old" which need CRLF else all is "one line"
i have this working Source which work under Xbase++
Code: Select all | Expand
#include "Directry.ch"
PROCEDURE MAIN()
LOCAL aDir
LOCAL cFile
LOCAL cMemo
LOCAL cOut
LOCAL i,iMax
aDir := Directory("*.PRG")
iMax := LEN(aDir)
FOR i := 1 TO iMax
cFile := aDir[i][F_NAME]
cMemo := MEMOREAD(cFile)
cMemo := StrTran(cMemo,CHR(10),CHR(13)+CHR(10))
cOut := UPPER(cFile)
cOut := StrTran(cOut,".PRG",".PPG") // just to have other Extension
MemoWrit(cOut, cMemo)
NEXT
RETURN
it should also run under harbour
greeting,
Jimmy
Jimmy