- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Header Files
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2004 05:33 AM
тАО12-15-2004 05:33 AM
Q1. Are these only available with C++ and not the standard Ansi C (HP-UX 11.0)?
Q2. Since I am forced to use getch when reading an input file, I have run into a problem where control characters are not read in, i.e. ^A, etc.
Anyone have a workaround? Escape characters do not appear to work, i.e. \^A.
dl
Solved! Go to Solution.
- Tags:
- curses
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2004 05:37 AM
тАО12-15-2004 05:37 AM
Re: Header Files
For question 1, yes. They are the header files for c++ library functions.
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2004 06:30 AM
тАО12-15-2004 06:30 AM
Re: Header Files
The following code will loop until you press 'q':
-------------------------------------
#include
int cinitscr(void) /* returns TRUE if ok */
{
int h = FALSE;
(void) initscr();
h = (stdscr != NULL);
if (h)
{
(void) scrollok(stdscr,TRUE);
(void) cbreak();
(void) noecho();
(void) nl();
(void) keypad(stdscr,TRUE);
}
return(h);
} /* cinitscr */
int main()
{
if (cinitscr())
{
int ch = 0;
while (ch != 'q')
{
(void) printw("Enter char: ");
(void) refresh();
ch = getch();
if (ch >= ' ' && ch <= '~') (void) printw("%c",(char) ch);
else (void) printw(" ");
(void) printw(" %4o\n",ch);
(void) refresh();
}
endwin();
}
return(0);
}
---------------------------------------
compile/link like this:
cc key.c -lcurses -o key
If I got all that typed in without any boo-boos it should work just as claimed.
Oh, and no, ANSI C don't know nothing about them C++ constructs like streams.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2004 09:46 AM
тАО12-15-2004 09:46 AM
Re: Header Files
Clay, some additional information-
Purpose is to read in an array to the program that will be using this array to pass a buffer via a tcp socket program to a mainframe CICS application. Unfortunately, this buffer must be interpreted from the acii characters it receives in the buffer.
With that in mind, I don't believe the key characters would be viable, unless I am missing something.
Regards,
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-15-2004 01:28 PM
тАО12-15-2004 01:28 PM
Re: Header Files
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2004 04:23 AM
тАО12-16-2004 04:23 AM
Re: Header Files
Will give it a shot, report results, assign points. Thanks for clarification.
Incidentally, I would much rather have used getline() since the file I will read from has a number of parms I want included in the socket program. I was forced to use getch() due to the lack of appropriate header files.
This is not a life or death production issue.
The socket program is my emulation of scenarios where it performs as a banking institution, POS contoller, etc. and used for testing against the CICS socket programs.
Always appreciate your input and posts.
Best regards,
dl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2004 06:00 AM
тАО12-16-2004 06:00 AM
Re: Header Files
file. Why are you "forced to use getch"?
getch doesn't even read from a file, it reads
from the terminal! Perhaps you actually
want getc or getchar, or even scanf.
What is getline()? It does not appear
to be a part of the standard C library.
In C the usual way to read til EOL is
fgets().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2004 06:19 AM
тАО12-16-2004 06:19 AM
Re: Header Files
Gregory is correct.
Here is a snippet of my problem:
Below is how I read the input file-
output[i] = fgetc(input_file);
This is the data I want to read in-
\0^A0\0\0^D\0^N\0\0\0\0P\0 rrrrrrrrrrr00050000010005Y
This is what I get-
\00\0\0\0\0\0\0\0P\0 rrrrrrrrrrr00050000010005Y
As you can see, I lose the ^A, ^D, ^N.
If I hard code in the unix socket program, the buffer is passed correctly to the mainframe CICS socket program.
If I read the data into the unix socket program, the buffer passed to CICS is minus any ^A, etc.
Sorry for not stating this correctly in the beginning.
dl
- Tags:
- fgetc
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2004 09:05 AM
тАО12-16-2004 09:05 AM
Solution----------------------------------
#include
#include
#include
#include
#define assign_errno(x) ((errno != 0) ? errno : (x))
static void problem(char *msg, int err)
{
(void) fprintf(stderr,"%s (%d)\n",msg,err);
(void) fflush(stderr);
return;
} /* problem */
#define STDOUT_FDES 1
int main(int argc, char *argv[])
{
int cc = 0;
if (argc > 0)
{
char *in_fname = NULL,s_err[512];
int in_fdes = -1;
in_fname = argv[1];
in_fdes = open(in_fname,O_RDONLY,0400);
if (in_fdes >= 0)
{
int n = 0;
unsigned char b[1024];
do
{
n = read(in_fdes,(void *) b,sizeof(b));
if (n > 0)
{
/* your stuff goes here */
/* send n bytes stored in b */
/* I'll just write on stdout */
(void) write(STDOUT_FDES,(void *) b,(size_t) n);
}
else
{
if (n < 0)
{
cc = assign_errno(-2);
problem("Read failed",cc);
}
}
}
while ((n == sizeof(b)) && (cc == 0));
(void) close(in_fdes);
}
else
{
cc = assign_errno(-1);
(void) sprintf(s_err,"Can't open file '%s'",in_fname);
problem(s_err,cc);
}
}
else
{
cc = 254;
problem("No input file",cc);
}
return(cc);
} /* main */
-----------------------------------------
Compile like this:
cc tester.c -o tester
As a test: tester tester will read in the source and output it to stdout, if I got all this typed in correctly.
That should do it. Where I'm doing the write() is where you will probably put your send() after setting up the socket.
- Tags:
- read
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-16-2004 11:09 AM
тАО12-16-2004 11:09 AM
Re: Header Files
Danged if that didn't work!!!!!!!
Thanks for all the time spent on this.
Best regards,
dl