From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.148.65 with SMTP id w62mr52755845iod.34.1452290926405; Fri, 08 Jan 2016 14:08:46 -0800 (PST) X-Received: by 10.182.231.229 with SMTP id tj5mr492079obc.13.1452290926386; Fri, 08 Jan 2016 14:08:46 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.swapon.de!newsfeed.fsmpi.rwth-aachen.de!newsfeed.straub-nv.de!feeder.erje.net!2.us.feeder.erje.net!news.glorb.com!o2no1127882iga.0!news-out.google.com!f6ni47564igq.0!nntp.google.com!o2no1127878iga.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 8 Jan 2016 14:08:46 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=149.32.224.36; posting-account=Qh2kiQoAAADpCLlhT_KTYoGO8dU3n4I6 NNTP-Posting-Host: 149.32.224.36 References: <77e47c8b-7dcc-4e86-8f89-1f348cdf08dd@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <43bc5562-18e9-451d-b7ce-7c050c41c2f6@googlegroups.com> Subject: Re: Re-write a file in Ada From: Anh Vo Injection-Date: Fri, 08 Jan 2016 22:08:46 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:29061 Date: 2016-01-08T14:08:46-08:00 List-Id: On Friday, January 8, 2016 at 1:22:57 PM UTC-8, Randy Brukardt wrote: > wrote in message=20 > news:77e47c8b-7dcc-4e86-8f89-1f348cdf08dd@googlegroups.com... > > Hello everybody , > > > > Next , a working code which re-write entirely a file . > > > > I would like to modify it , doing the same thing exept that : > > > > Undounded_strings will be generate every time there is a next line . > > > > Then , several get_line will be done on those strings . > > > > And in final , put those modified strings in the file . > > > > > > Anyone knows how to code that ? >=20 > I'm sure most of us can code whatever we need, and the above seems trivia= l.=20 > But most of us are also professional programmers, either working in Ada o= r=20 > working in some other language and doing hobby projects in Ada. We're hap= py=20 > to help, but being pros has two effects: >=20 > (1) We're not interested in writing other people's programs for them. We'= ll=20 > help people learn, but that's very different. > (2) One of the first things that professional programmers learn is that t= he=20 > hardest thing to do is to debug someone else's code. >=20 > On top of which, you gave code (which is good), but you never explained (= in=20 > detail!) what happens compared to what you expect. Given that, the only= =20 > serious alternative is to spend a hour or more figuring out what you're= =20 > trying to do and then create a program (from scratch) that does that. I= =20 > suspect most everyone here has something better to do than that. (The onl= y=20 > time I'd do this is if I find the problem is interesting, which certainly= is=20 > not the case here.) >=20 > I, personally, rarely look at the code posted here; I provide help based = on=20 > the error and then work backwards from there. Since you didn't provide th= e=20 > error, and I'm surely not going try to load and compile your code, attemp= t=20 > to figure out what data you are reading, whether the results I get make a= ny=20 > sense, and so on. >=20 > I'd suggest telling us what results you are getting from your code and wh= at=20 > you are expecting, and perhaps someone will want to help you (but no=20 > promises). I agreed 100% with Randy.=20 Tell me if I understood you correctly. You wanted to read text in your sour= ce text (main.adb) one line at time. Then, they are concatenated into a sin= gle line of text for entire file. For example, if there are two lines of te= xt, as shown below, the result would be one line of text as shown in the bo= ttom. with Ada.Text_IO.Unbounded_IO ; use Ada.Text_IO.Unbounded_IO ; with Ada.Strings.Unbounded ; use Ada.Strings.Unbounded ; with Ada.Text_IO.Unbounded_IO ; use Ada.Text_IO.Unbounded_IO ;with Ada.Str= ings.Unbounded ; use Ada.Strings.Unbounded ; Anh Vo