Dear friends:
I get different resutls when copy my code from windows to linux system.
the string comparion " if( keyword==Key[0] ) " is true in window system, but it is false in linux system. I am really confused about this.I copy the same source code and the same input file from window to linux system.I use vs2008 in windows 7, and g++ in open suse linux 11.4.

Could you please give me some information about that.

Key[0]="NODAL COORDINATES";
		   Key[1]="ELEMENT GROUPS";
		   Key[2]="ENTITY NAME:   GEOM                ";

while( !infile.eof() )
				 {     getline(infile,keyword,'\n');  // '\n' is a end 
			             if( keyword==Key[0] )   
							 { 
                                                            // read the points coordinates

     }						          }

Recommended Answers

All 5 Replies

Member Avatar for danb737

Just a wild guess. Would there be a problem because Windows end of line are \r\n, while Unix end of line are \n only ?

I copy the text file from windows to linux directly.
Could you please tell me how you convert the \r\n line endings of windows into the \n line endings of Linux
Regards

Are you comparing char* to char*? It depends on the datatype of keyword. If so then consider using strcmp function of change from char* to std::string

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.