delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/28/17:49:46

Message-ID: <38670DE3.B1D7D2E5@earthlink.net>
From: Martin Ambuhl <mambuhl AT earthlink DOT net>
X-Mailer: Mozilla 4.7 [en] (Win95; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Changing Text with Iteration...
References: <83ve6e$bur$1 AT bob DOT news DOT rcn DOT net> <s6ds8d53h4579 AT corp DOT supernews DOT com>
Lines: 63
NNTP-Posting-Host: 209.246.64.169
X-Complaints-To: abuse AT earthlink DOT net
X-Trace: newsread1.prod.itd.earthlink.net 946277806 209.246.64.169 (Sun, 26 Dec 1999 22:56:46 PST)
NNTP-Posting-Date: Sun, 26 Dec 1999 22:56:46 PST
Organization: EarthLink Network, Inc.
X-ELN-Date: Sun Dec 26 22:56:46 1999
X-ELN-Insert-Date: Sun Dec 26 22:56:46 1999
X-Posted-Path-Was: not-for-mail
Date: Mon, 27 Dec 1999 06:56:46 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com


Al Morgan wrote:
> 
> I don't use that header file, so I can't help with the rest of the program,
> but dont' you want to:
> 
> #include <string.h>
> 
> (with emphisis on the .h).

No, his code is C++, using the string objects for which the interface is
in the C++ header <string>.  There is no <string.h> header in C++,
althogh g++ will accept it.  The C++ header for the functionality of C's
<string.h> is <cstring>.

> 
> Tom <thomasbd AT erols DOT com> wrote in message
> news:83ve6e$bur$1 AT bob DOT news DOT rcn DOT net...
> > Can anyone tell me what is wrong with the following code?  I am trying to
> > load a mp3 playlist into memory and then change each "\" to a "/" so it
> can
> > be read by the software I am using.  I can only get the first line to
> work.
> > I am trying to assign each line to a number with the string a[int].
> Please
> > help.  Thanks.
> >
> > #include <fstream>
> > #include <string>
> >
> > int main()
> > {
> > string a[500];
> > string s;
> > int n = 0;
> > int m = -1;
> > ifstream inputfile("mylist.m3u");
> > while ( getline( inputfile, s) )
> > {
> > while (s[++m])
> > {
> > if (s[m] == (char) 92)
> > s[m] = (char) 47;
> > }
> > a[++n]=s;
> > cout << n << ". " << a[n] << endl;
> > }
> > return 0;
> > }
> >
> >

-- 
Martin Ambuhl	mambuhl AT earthlink DOT net

What one knows is, in youth, of little moment; they know enough who
know how to learn. - Henry Adams

A thick skin is a gift from God. - Konrad Adenauer
__________________________________________________________
Fight spam now!
Get your free anti-spam service: http://www.brightmail.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019