Geeh
Geeh

Reputation: 11

Error: expected ')' before numeric constant (fwrite)

I have searched around the internet for a solution, but I still cannot find it. So I signed up here, hopefully some of you could help me. I am still learning C, so pardon if it is a stupid question. I've recently made a code, and everything worked fine, until I decided to add an fwrite, here's what it looks like:

char str[] = "Test.";
fwrite(str, 1, sizeof(str), Console);

I tried to compile it, and the compiler gives me an error:

Main.c:57:13: error: expected ')' before numeric constant

What is the problem, and how can I fix it?

Upvotes: 0

Views: 829

Answers (2)

nix
nix

Reputation: 118

Try this

char str[] = "Test.";
fwrite(&str, sizeof(char), sizeof(str), stdout);

Although, I think the problem might be due to an open parentheses somewhere else in the code.

Upvotes: 1

Chirag Bansal
Chirag Bansal

Reputation: 84

Try stdout in place of Console.

Upvotes: 0

Related Questions