Hi ,

There is a problem in sun solaris8 v880 machine.
Our application in C++ reads a file using ifstream.
The compiler we are using is
/opt/SUNWspro/WS6U2/bin/CC
This file stream function does not behave properly.It
duplicates the first character in the file at the
first position.

Please find the following program that simulates the
issue,

#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <iomanip.h>
main()
{
    char text_name[50];
    char filename[50];
    ifstream instream;
   
strcpy(filename,"/opt/css/roshan/utils/file/sample.txt");
    instream.open(filename, ios_base::in);
    instream.read(text_name,50);
    instream.close();
    cout << "\nThe Content of FILE is : " <<
text_name;
}

The input file content are as follows,

[/opt/css/roshan/utils/file]>$cat *.txt
This is a TEST Message
This contains Data

The output of the program is as follows,

[/opt/css/roshan/utils/file]>$./a.out
The Content of FILE is : TThis is a TEST Message
This contains Data

Can any one tell us why there is a  duplication
[TThis] in the out put.

Regards,
Selva



                
__________________________________ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com
_______________________________________________
Solaris-Users mailing list
[email protected]
http://www.filibeto.org/mailman/listinfo/solaris-users

Reply via email to