HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: Strange thing with a C program
Operating System - OpenVMS
1827837
Members
1416
Online
109969
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
07-04-2003 08:49 AM
07-04-2003 08:49 AM
Strange thing with a C program
Here is the following program :
#include
int main()
{
fputs(" dcc: C programs checker. Copyright 1995 Supelec.\n", stdout);
fputs("1 warning(s) reported (0 message(s) masked).", stderr);
(void) getchar();
fputs("----------------------------------------\n", stdout);
fputs("Stderr2\n", stderr);
fputs("Stderr21\n", stderr);
return 1;
}
If you run it on a Unix system, it's OK.
If you run it on an OpenVMs system there is a problem because Stderr2 is written on the same line as the dashes so there is no return to the line after the first fputs.
if you comment the getchar, it's working....
Is it a bug or an hidden feature ?
Thanks
Daniel
#include
int main()
{
fputs(" dcc: C programs checker. Copyright 1995 Supelec.\n", stdout);
fputs("1 warning(s) reported (0 message(s) masked).", stderr);
(void) getchar();
fputs("----------------------------------------\n", stdout);
fputs("Stderr2\n", stderr);
fputs("Stderr21\n", stderr);
return 1;
}
If you run it on a Unix system, it's OK.
If you run it on an OpenVMs system there is a problem because Stderr2 is written on the same line as the dashes so there is no return to the line after the first fputs.
if you comment the getchar, it's working....
Is it a bug or an hidden feature ?
Thanks
Daniel
Daniel
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-04-2003 06:03 PM
07-04-2003 06:03 PM
Re: Strange thing with a C program
Hello Daniel,
the problem is the missing \n at teh end of the
fputs("1 warning(s) reported (0 message(s) masked).", stderr);
line. So stderr tries to continue to write on the same line as before, which has already been used
by stdout.
Add the \n and your output should look ok.
Greetings, Martin
the problem is the missing \n at teh end of the
fputs("1 warning(s) reported (0 message(s) masked).", stderr);
line. So stderr tries to continue to write on the same line as before, which has already been used
by stdout.
Add the \n and your output should look ok.
Greetings, Martin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2003 12:38 AM
07-05-2003 12:38 AM
Re: Strange thing with a C program
Martin,
I agree that it could be fixed this way, but why does it work on a Unix system ?
Thanks
Daniel
I agree that it could be fixed this way, but why does it work on a Unix system ?
Thanks
Daniel
Daniel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2003 07:43 AM
07-05-2003 07:43 AM
Re: Strange thing with a C program
Hello Daniel,
I am not entirely sure about this either. It is
obviously an interaction between the various I/O streams on the terminal device. Each single stream behaves exactly as you would expect. To see this do the following:
$define/user sys$output out.txt
$define/user sys$error err.txt
then run your test program. Afterwards out.txt and err.txt do contain exactly what you would expect from the fputs statements, i.e. without the \n err.txt is
1 warning(s) reported (0 message(s) masked).Stderr2
Stderr21
Greetings, Martin
I am not entirely sure about this either. It is
obviously an interaction between the various I/O streams on the terminal device. Each single stream behaves exactly as you would expect. To see this do the following:
$define/user sys$output out.txt
$define/user sys$error err.txt
then run your test program. Afterwards out.txt and err.txt do contain exactly what you would expect from the fputs statements, i.e. without the \n err.txt is
1 warning(s) reported (0 message(s) masked).Stderr2
Stderr21
Greetings, Martin
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Support
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP