troubleshooting Question

fscanf problem

Avatar of openujs
openujs asked on
4 Comments1 Solution397 ViewsLast Modified:
I am trying to use fscanf. I have a text file which contents - test|localhost||clienthost|4350|testUser|test|login|No Message

I have struct which is -
typedef struct _packetFormat
   char ipServerAddress[100];
   char ipServerName[100];
   char ipClientAddress[100];
   char ipClientName[100];

   int portNum;
   char userName[100];
   char password[100];
   char command[100];
   char message[5000];


fscanf( f,

I am trying to parse the file and populate the member variables of the struct. For some reason, I am not getting the correct values.  ipServerAddress should have " test". How can I achieve this with fscanf(), any other alternatives?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros