#1
|
|||
|
|||
![]()
I'm trying to load some text into a text file and I used the following code:
textFile$ = FOpen ({test.txt}, "r" ![]() firstline$ = ReadString (textFile$); Edit_Set(EDIT103$, firstline$); It didn't work (and I got an access violation). I'm sure I'm not even using these properly. Is there a PPL file somewhere that uses these commands so I can use it as a model? Or do I need to hunt for some C examples on the Internet? Thanks, as always! |
#2
|
|||
|
|||
![]()
Oops. I completely missed the part in the help file that addresses these commands. Sorry. I'll post back if I can't figure it out after reading them. Sorry to waste everyone's time.
|
#3
|
|||
|
|||
![]()
Does anyone remember how to specify a carriage return? What I'm trying to do is read several lines of a textfile. I can read one line but don't know how to read the next. Thanks!
|
#4
|
|||
|
|||
![]()
it should be \r or chr$(13) may be you need also a \n for newline aka chr$(10)
|
#5
|
|||
|
|||
![]()
Are you trying to read the whole file into the edit control or just part of it? If you want to read the whole file, simply use the command Edit_LoadFromFile(Edit$, FileName$). Now let's say you just wanted to read the first 10 lines. You could do something like this:
Code:
fp$ = fopen("filename", "r"); x$ = 0; data$ = ""; while((x$ < 10) and (not(feof(fp$)))) line$ = ReadString(fp$); data$ = data$ + line$ + "\n"; x$++; end; fclose(fp$); Edit_Set(Edit$, data$); Forgot to mention that if you haven't already, make sure the ES_MULTILINE property is set. |
#6
|
|||
|
|||
![]()
Thanks matteo.m and PointOfLight! I will try it right away! And as always, thanks VERY much!
|
#7
|
|||
|
|||
![]()
POL: What does x$ <; 10 mean? Specifically, why the semicolon?
|
#8
|
|||
|
|||
![]()
Sorry, that was supposed to be "less than or equal". For some reason when you put an = next to a < it translates the = as a ;.
|
#9
|
|||
|
|||
![]()
The order Edit_Loadfromfile (edit$, filemname$) does not seem to function. Here two lines simple to replace the code of the procedure.
proc Edit_LoadFromFile (edit$, Filename$) local (s$, i$, slist$); s$ = LoadStr (Filename$, i$); settext (edit$, s$); end; In the same idea have can replace the procedure Edit_SaveToFile (edit$, Filename$), even if this one functions well with l' origin. proc Edit_SaveToFile (edit$, Filename$) local (lst$, savetext$); savetext$=gettext (edit$); savestr (fn$, savetext$, length (savetext$)); end; I ask for myself why the original orders places by lists? Last edited by Alain Carignan; 09-14-2008 at 06:20 AM. |
![]() |
Thread Tools | Search this Thread |
Display Modes | |
|
|