Hi,

So essentially I want to read every string in a file, then read every character in that string, find out if the string has two periods somewhere in it, and then save that string somewhere.

Can someone get me started in the right direction?

Recommended Answers

All 3 Replies

Define what you mean by "string", because the whole file can be a string, each line can be a string, each word can be a string (for various definitions of "word"), to name three common needs.

Hmm...an "array" rather? Words or numbers separated by spaces on either side.

Hmm...an "array" rather?

That's even more confusing. ;)

Words or numbers separated by spaces on either side.

I'd call that a word. You basically want fscanf's default behavior for string data:

char buf[100];

while (fscanf(in, "%99s", buf) == 1)
{
    puts(buf);
}
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.