Recommended Answers
Jump to Postallocate the array with either malloc() or new, depending on whether you are writing a c or c++ program.
Jump to PostWhere is
fINPUT
anywhere in your code ? It would be really better for the others to understand if you post the entire code or the module so that we can be of some help.Hoping to hear from you.
Bye.Regards,
~s.o.s~
Jump to Post>>fscanf( fINPUT, "%s", &IP_name[j]);
IP_name is a simple charater array, not an array of strings. If you want to store two or more strings in IP_name (for example "Joe" and "Harray") then you need to make IP_name an array of InputNumber number of strings. Something like this. But if …
Jump to PostHi I've done like this and it works:
char **IP_name; IP_name = new char* [InputNumber]; for (int i=0; i<InputNumber; i++) { IP_name[i] = new char[20]; fscanf( fINPUT, "%s", &IP_name[j]); printf("%s\n", &IP_name[j]); }
The only problem is to free the memory with delete... I tried with:
for (i=0; …
All 14 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.