www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/12/24/12:34:54

From: "Tom" <thomasbd AT erols DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Changing Text with Iteration...
Date: Fri, 24 Dec 1999 04:44:12 -0500
Lines: 30
Message-ID: <83ve6e$bur$1@bob.news.rcn.net>
X-Trace: ABrmO9X8btdiMiMhTMimx5PF2U0OqVc1ziAOSOGuopfMurUzgQOsrg==
X-Complaints-To: abuse AT rcn DOT com
NNTP-Posting-Date: 24 Dec 1999 09:25:34 GMT
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600
X-Newsreader: Microsoft Outlook Express 5.00.2919.6600
X-MSMail-Priority: Normal
X-Priority: 3
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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;
}


- Raw text -


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