Home > Enterprise >  strcmp() in C not giving accurate value when run on linux server
strcmp() in C not giving accurate value when run on linux server

Time:11-18

I am trying to compare two strings in my c program with a .csv files input. Everything works fine when I run it on my localhost as a cgi-program. But upon uploading on to linux server it doesn't compare properly. The output file shows despite being the same value it's compared output is different. And I think the linux server is running C99 compiler for C. I have only pasted the code where it creates the problem. If you want to take a look at the full code follow the link please enter image description here

CodePudding user response:

strcmp will work only correct, if both character string are terminated with an null character. If they are missing, the comperation will be failed and furthemore you can corrupt the system.

  • Related