Hi Guys,

Ive been trying to write an app to receive exports of songnames from a broadcast automation system

it receives the export via TCP/IP

for the most part it works however I cannot get it to rotate songnames around in an array

var
  export:array[1..175] of char;
  songs:array[1..8] of string;
  station,song: string;
  artist,artist1: string;
  s: string;
  n: Integer;
  ch: char;
  outfile: text;
begin
  if aSocket.GetMessage(s) > 1 then begin // Data received from telnet session
      for n:=1 to 176 do begin
      ch:=s[n];
      export[n]:=ch;
      end;
      station:=export[76..92];
      song:=export[111..175];
      songs[1]:=song;
      songs[5]:=songs[4];
      songs[4]:=songs[3];
      songs[3]:=songs[2];
      songs[2]:=songs[1];
      write(TimeToStr(Time));
      writeln(' Received Export from station: ',station,'');
      writeln('! Now Playing: ',song,' ',artist,'');
      writeln('! Just played: ',songs[2],'');
      writeln('! Previous:    ',songs[3],'');
      writeln('! Previous:    ',songs[4],'');
      writeln('! Previous:    ',songs[5],'');
      assign(outfile,'/root/hot91export.txt');
      rewrite(outfile);
      writeln(outfile,station);
      writeln(outfile,'&song1= ',song,'');
      writeln(outfile,'&artist1=',artist,'');
      writeln(outfile,'&song2=',songs[2],'');
      writeln(outfile,'&artist2=',artist1,'');
      close(outfile);

this is the output of the program

10:37:31 Received Export from station: Network
! Now Playing: SAY-JOHN MAYER

! Just played:
! Previous:
! Previous:
! Previous:
! Previous:

any help is appreciated, im a bit rusty havent coded for 15 years or so.. any idea what im doing wrong?

I think ive worked out the issue just not sure how to fix it

I need to make the varibles in main global and public

Does anyone know how to do this? Im using freepascal

Is this just a procedure?
If yes ,then write me how to get value the procedure's arguments,ok?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.