discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMutableString -initWithFormat appends to existing text


From: Mick Bert
Subject: Re: NSMutableString -initWithFormat appends to existing text
Date: Wed, 18 Apr 2018 11:54:15 +0200

2018-04-18 11:29 GMT+02:00 Ivan Vučica <ivan@vucica.net>:
>
>
> On 18 Apr 2018, at 09:23, Mick Bert <micbert75@gmail.com> wrote:
>
> 2018-04-18 9:52 GMT+02:00 H. Nikolaus Schaller <hns@goldelico.com>:
>
>
> -init or -initWithFormat: should be called only once and only after +alloc.
> You use stringWithCapacity which has already been initialized.
>
> Use -setString:@"" followed by -appendWithFormat: instead.
>
> Thanks a lot!
> Now it works as expected.
>
>
> It may, but invoking init multiple times is still a bad idea.
>
I mean: now, that I applied the above suggestion, it works ^__^

>
> One question more. I am writing in a text file, by formatting NSString
> objects to give to NSFileHandle -writeData.
> Is it the preferable way? Are there any other class to work with
> text-oriended files?
>
>
> If you don’t need anything more, NSString includes writeToFile:.
>
> What does a ‘text oriented file’ mean?

With test-oriented i mean generic text streams, organized as a sequence of
variable length lines, separated by new-line character. Very generic readable
text.

I cannot load the entire file in memory, because it is too big. Thus I
process it
line by line, writing the output in an other file.

--
Mick



reply via email to

[Prev in Thread] Current Thread [Next in Thread]