arrow keys in linux
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > arrow keys in linux




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    arrow keys in linux  
tsamisa@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-30-06 06:20 AM

I'm writing an application that automatically access a webpage and
fills some blanks using lynx. I send char "g" then the url and up to
that point it works fine. My problem is that i can't send the ascii
code (i tried ascii 80,66,25) for arrow dwn in order for lynx to move
to the next i/p field or hyperlink.

Here is the code



#include <stdio.h>

#include <sys/wait.h>

#include <fcntl.h>

#include <unistd.h>

#include <pthread.h>

#include <time.h>

#include <string.h>



void writer ( FILE* stream,int sleeptime)

{
sleep(2);

fprintf(stream,"g");

sleep(1);
fprintf(stream,"www.msn.com\n");
sleep(1);
//here it was supposed to move through the screen
fprintf(stream,"%c",25);

fflush (stream);
sleep (sleeptime);

}

int main(int argc,char * argv[])
{
char lynx[400];
int fds[2];
pid_t pidntw;
FILE *stream;
strcpy(lynx,"lynx");
pipe (fds);
pidntw = fork();
if(pidntw == (pid_t) 0)
{
close (fds[1]);

close(0);

dup2 (fds[0],STDIN_FILENO);

execlp(lynx,"lynx","-accept_all_cookies",0);
return(1);
}
else
{
close (fds[0]);
stream = fdopen (fds[1], "w");
if (ferror (stream) || stream==NULL)
printf("ERROR!! 3\n");
writer(stream,10);
fclose(stream);
close (fds[1]);
waitpid(pidntw,NULL,0);
}
return 0;
}






[ Post a follow-up to this message ]



    Re: arrow keys in linux  
Thomas Dickey


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
05-30-06 06:15 PM

tsamisa@gmail.com <tsamisa@gmail.com> wrote:
> I'm writing an application that automatically access a webpage and
> fills some blanks using lynx. I send char "g" then the url and up to
> that point it works fine. My problem is that i can't send the ascii
> code (i tried ascii 80,66,25) for arrow dwn in order for lynx to move
> to the next i/p field or hyperlink.

lynx has a log- and command- option pair which is supposed to do this.

The current version of lynx is 2.8.5

It's available at
http://lynx.isc.org/lynx2.8.5/
2.8.6 Development & patches:
http://lynx.isc.org/current/index.html

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:17 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register