Hi,

I have a question regarding fscanf. In my program I call fscanf(fp, "%15[^,],%d,%315[^;];", anum, &bal, cust) .

Everything works fine and there is no problem with the syntax, the only trouble I am having is that I need to copy the ';' as well into cust and use it as a delimiter.

I tried strcat and to do it manually using array manipulation but it doesn't seem to work.

Do you guys have any ideas? Thanks in advance.

Recommended Answers

All 2 Replies

I'd say append the delimiter onto cust if fscanf succeeds. You say this "didn't work", but that's a useless statement without a full description of what it does, what you expected it to do, and the actual code so we can verify that you did it correctly.

Another solution (I know, you see this one all the time): don't use scanf or it's partners. If you use low level input functions and do the converting yourself, you have much more control over what you can do.

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.