Lazarus
Home
Help
TinyPortal
Search
Login
Register
Lazarus
»
Forum
»
Using the Lazarus IDE
»
General
»
Why lazarus convert the encoding of files in mode graphical?
Free Pascal
Website
Downloads
Wiki
Documentation
Bugtracker
Mailing List
Lazarus
Website
Downloads (Laz+FPC)
Packages (OPM)
FAQ
Wiki
Documentation (RTL/FCL/LCL)
Bugtracker
CCR Bugs
GIT
Mailing List
Other languages
Foundation
Website
Useful Wiki Links
Project Roadmap
Getting the Source
Screenshots
How to use the forum
Forum Rules
About donations (wiki)
Bookstore
Computer Math and Games in Pascal
(preview)
Lazarus Handbook
Search
Advanced search
Recent
Remote desktop software i...
by
gidesa
[
Today
at 02:25:43 pm]
Omitting semicolon on las...
by
Xenno
[
Today
at 02:04:31 pm]
Lazarus Image Editor
by
Paolo
[
Today
at 02:04:10 pm]
FPC Unleashed (inline var...
by
Thaddy
[
Today
at 01:44:27 pm]
I can write your README.m...
by
domasz
[
Today
at 09:53:02 am]
fp-h2pas: New C header tr...
by
ccrause
[
Today
at 09:48:31 am]
Can /my/ AI help me with ...
by
cdbc
[
Today
at 08:59:28 am]
The ever re-appearing /= ...
by
440bx
[
Today
at 05:05:57 am]
android attack (inc)
by
speter
[
Today
at 04:19:54 am]
Little bit...
by
n7800
[
Today
at 03:51:08 am]
[ANN] Unofficial FPC 3.3....
by
440bx
[
Today
at 01:00:04 am]
NiceGrid component for La...
by
wp
[
Today
at 12:03:57 am]
Track windows cross-platf...
by
dsiders
[April 10, 2026, 07:43:43 pm]
[ANN] PasBuild v1.8.0 Rel...
by
Graeme
[April 10, 2026, 06:43:13 pm]
Подписи кнопок панели инс...
by
Raskaton
[April 10, 2026, 06:37:48 pm]
HTTPS-сервер с ГОСТ-серти...
by
Raskaton
[April 10, 2026, 06:29:36 pm]
Strange behavior with dat...
by
JanRoza
[April 10, 2026, 06:20:38 pm]
RegExpr matchting empty s...
by
Thaddy
[April 10, 2026, 04:35:27 pm]
TLazSerial : serial port ...
by
CM630
[April 10, 2026, 03:45:42 pm]
Can't pass string to TEdi...
by
lazarusprogrammer
[April 10, 2026, 02:04:36 pm]
Messing with Gemini AI an...
by
gidesa
[April 10, 2026, 12:48:03 pm]
Lazarus Bugfix Release 4....
by
dbannon
[April 10, 2026, 10:09:07 am]
[SOLVED] How to enter gen...
by
PascalDragon
[April 10, 2026, 07:27:12 am]
AI Assist Python - to - P...
by
PascalDragon
[April 10, 2026, 07:25:42 am]
How to remove a FORM from...
by
Martin_fr
[April 10, 2026, 12:29:46 am]
« previous
next »
Print
Pages: [
1
]
Author
Topic: Why lazarus convert the encoding of files in mode graphical? (Read 5227 times)
dicas3d
Jr. Member
Posts: 81
Why lazarus convert the encoding of files in mode graphical?
«
on:
July 02, 2010, 06:56:09 pm »
I use Lazarus 0.9.28.2 and I have a problem. I write a file with my program writed in Lazarus. This file is of type RECORD. And when i try read the file in the same program it don't read appropriately. It shows squares but not the correct data.
In the write moment i have this code:
Code: Pascal
[Select]
[+]
[-]
dir
:
=
c
+
'\carros.sgs'
;
delete
(
dir
,
0
,
4
)
;
carrosarray
[
i
+
1
]
.
nome
:
=
InputBox
(
'Criar carro'
,
'Introduza o nome do carro'
,
''
)
;
system
.
Assign
(
carrosfile
,
dir
)
;
system
.
ReWrite
(
carrosfile
)
;
For
contador
:
=
1
to
i
+
1
do
begin
Write
(
carrosfile
,
carrosarray
[
contador
]
)
;
End
;
system
.
Close
(
carrosfile
)
;
At the read moment i have this code:
Code: Pascal
[Select]
[+]
[-]
dir
:
=
c
+
'\carros.sgs'
;
system
.
assign
(
carrosfile
,
dir
)
;
system
.
ReSet
(
carrosfile
)
;
i
:
=
1
;
contador
:
=
1
;
while
not
eof
(
carrosfile
)
do
begin
system
.
Seek
(
carrosfile
,
contador
-
1
)
;
Read
(
carrosfile
,
carrosarray
[
contador
]
)
;
i
:
=
i
+
1
;
contador
:
=
contador
+
1
;
end
;
system
.
Close
(
carrosfile
)
;
«
Last Edit: July 02, 2010, 07:00:51 pm by dicas3d
»
Logged
Comunidade portuguesa Lazarus, Delphi, Lazarus e Pascal.
Lazarus Portugal no Youtube.
IRC online
ou #lazrusportugal em irc.ptnet.org
typo
Hero Member
Posts: 3051
Re: Why lazarus convert the encoding of files in mode graphical?
«
Reply #1 on:
July 02, 2010, 07:10:24 pm »
Try this:
Code:
[Select]
Write(carrosfile, carrosarray[contador][1]);
Logged
LazarusBrasil.Org
dicas3d
Jr. Member
Posts: 81
Re: Why lazarus convert the encoding of files in mode graphical?
«
Reply #2 on:
July 05, 2010, 10:00:21 am »
Don't work.
Logged
Comunidade portuguesa Lazarus, Delphi, Lazarus e Pascal.
Lazarus Portugal no Youtube.
IRC online
ou #lazrusportugal em irc.ptnet.org
dicas3d
Jr. Member
Posts: 81
Re: Why lazarus convert the encoding of files in mode graphical?
«
Reply #3 on:
July 05, 2010, 12:40:13 pm »
I can solute it. The trick is remove the "{$H+}" from the top of the unit that have the RECORD's. To avoid problems the RECORD's must has be on a separated unit.
Logged
Comunidade portuguesa Lazarus, Delphi, Lazarus e Pascal.
Lazarus Portugal no Youtube.
IRC online
ou #lazrusportugal em irc.ptnet.org
vvzh
Jr. Member
Posts: 58
Re: Why lazarus convert the encoding of files in mode graphical?
«
Reply #4 on:
July 05, 2010, 02:51:27 pm »
You can try to use "string[255]" instead of plain "string" in record fields and keep {$H+} directive. This way there is no need in separate unit.
Logged
Marc
Administrator
Hero Member
Posts: 2680
Re: Why lazarus convert the encoding of files in mode graphical?
«
Reply #5 on:
July 07, 2010, 11:11:44 am »
Better not to fiddle with directives if you need shortstrings in a record.
as vvzh said you can use sting[nn] for a fixed length string or just ShortString (which is a string[255])
Same if you need ansistrings, just use AnsiString instead of string.
Logged
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the
bug tracker
Print
Pages: [
1
]
« previous
next »
Lazarus
»
Forum
»
Using the Lazarus IDE
»
General
»
Why lazarus convert the encoding of files in mode graphical?
TinyPortal
© 2005-2018