Page 2 of 4
Posted: Mon Dec 31, 2001 1:20 pm
by BackupUser
Restored from previous forum. Originally posted by redacid.
Fred: the source Danilo sent to you is exactly the same way as I tried it.
It just didn`t work on my machine:
PB2.70, WinXP-Pro, Gericom Notebook, 1,1GHz, 256MB RAM, 20GB HD, DVD, 1024x768x16.
If you need a "better" test, just tell me what I have to do and I will test it.
Posted: Mon Dec 31, 2001 2:58 pm
by BackupUser
Restored from previous forum. Originally posted by Paul.
Hello Wayne1,
Your FileEx library came through corrupt. Could you upload it agian.
Thanks.
Posted: Wed Jan 02, 2002 7:42 am
by BackupUser
Restored from previous forum. Originally posted by Ralf.
Thanks to all and a happy new year.
the program works now fine with Openfile (1) und Readfile (0)
Posted: Wed Jan 02, 2002 8:56 am
by BackupUser
Restored from previous forum. Originally posted by Ralf.
the programms works only with small files ?
when i use a file with 1 Kb it works, when i use
a file with 27 Kb it doesn't work.
Is the filesize limited ?
1.) Use Repeat... Until together with EOF()
2.) Use Readfile, not Openfile for the 1st file..
Procedure.s Replace(S$,R$,N$) While FindString(S$,R$,1)>0 S$=Left(S$,(FindString(S$,R$,1)-1))+N$+Right(S$,Len(S$)-(FindString(S$,R$,1)+Len(R$)-1)) Wend ProcedureReturn S$ EndProcedure ;---------------------------------------------------------------------- If ReadFile(0, "D:\TEST\DTA.TXT") If OpenFile(1, "D:\TEST\DTA2.TXT") Repeat UseFile(0) TEMP.s = ReadString() TEMP.s = Replace (TEMP.s, "0128AGK", "5555AFP" ) UseFile(1) WriteStringN(TEMP.s) Until Eof(0) 0 EndIfEndIfEnde:CloseFile(0) CloseFile(1)
cya,
...Danilo
(registered PureBasic user)
Posted: Wed Jan 02, 2002 9:36 am
by BackupUser
Restored from previous forum. Originally posted by PB.
the programms works only with small files ?
when i use a file with 1 Kb it works, when i use
a file with 27 Kb it doesn't work.
Is the filesize limited ?
Here's my solution. Works with a 672 Kb file, too.
Code: Select all
Procedure$ replace(string$,old$,new$)
r=1 : pos=1
While r0
r=FindString(string$,old$,pos)
If r0
string$=Left(string$,r-1)+new$+Mid(string$,r+Len(old$),Len(string$))
pos=pos+Len(new$)
EndIf
Wend
ProcedureReturn string$
EndProcedure
;
If ReadFile(0,"c:\original.txt")
If CreateFile(1,"c:\modified.txt")
Repeat
UseFile(0)
s$=ReadString()
s$=replace(s$,"0128AGK","5555AFP")
UseFile(1)
WriteStringN(s$)
Until Eof(0)0
EndIf
EndIf
PB - Registered PureBasic Coder
Posted: Wed Jan 02, 2002 10:08 am
by BackupUser
Restored from previous forum. Originally posted by Ralf.
didn't work .
compiler crashed with a 8 Kb file.
Posted: Wed Jan 02, 2002 11:16 am
by BackupUser
Restored from previous forum. Originally posted by fred.
Code: Select all
;----
OpenConsole()
If OpenFile(0, "C:\TEST.PB")
UseFile(0)
TEMP.s = ReadString()
PrintN(TEMP.s)
Delay(3000)
CloseFile(0)
EndIf
;----
Bug found and fixed.
Fred - AlphaSND
Posted: Wed Jan 02, 2002 11:26 am
by BackupUser
Restored from previous forum. Originally posted by Ralf.
hello PB.
ZZZ.exe worked.
can i get the source.
Posted: Wed Jan 02, 2002 12:42 pm
by BackupUser
Restored from previous forum. Originally posted by Ralf.
i took a 8 KB file a zzz.exe didn't work.
Posted: Wed Jan 02, 2002 8:58 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
ZZZ.exe worked.
can i get the source.
The source is the code I posted above, which you said didn't work.
PB - Registered PureBasic Coder
Posted: Wed Jan 02, 2002 8:59 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
i took a 8 KB file a zzz.exe didn't work.
Is the 8 kb file a normal text file?
Can you E-Mail it to me please so I can see for myself?
PB - Registered PureBasic Coder
Posted: Thu Jan 03, 2002 7:42 am
by BackupUser
Restored from previous forum. Originally posted by Ralf.
It works now with the new version 2.80 with filesizes up to 64 KB.
But i can mail you a sample file. it's text.
Edited by - Ralf on 03 January 2002 07:43:28
Posted: Thu Jan 03, 2002 8:47 pm
by BackupUser
Restored from previous forum. Originally posted by PB.
It works now with the new version 2.80 with filesizes up to 64 KB.
I've e-mailed you the source and exe that works on a 672 KB file.
PB - Registered PureBasic Coder
Posted: Thu Jan 03, 2002 11:06 pm
by BackupUser
Restored from previous forum. Originally posted by fred.
If your read line by line, it should work with 2Gb files without any problem.. .
Fred - AlphaSND
Posted: Fri Jan 04, 2002 10:16 am
by BackupUser
Restored from previous forum. Originally posted by PB.
If your read line by line, it should work with 2Gb files without any problem.. .
That's what my example does.
PB - Registered PureBasic Coder