Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Your information in this site is absolutely WONDERFUL. It is the most useful site on the web to me right now. Thank You Thank You..."

Geography

Where in the world do Tek-Tips members come from?
aaronvegh (TechnicalUser)
1 Nov 07 22:12
Hi there,
I've got some C experience, but not a ton. I'm working on integrating a library of C code into a C project that I'm writing, but I'm stumbling on supplying a required argument because I don't have the right data type. The function signature is

static void blockPrint (FILE *fp, const BYTE *block, int blockBits, const char *tag)

It's the first argument that I'm not getting. In the example code for this function, a regular string is being sent to this function (i.e. "file.txt"), but in my code I have the file path in question supplied as a const char *. But what the heck is a var of type FILE? I can't find this anywhere in Google or the C docs.

I'm guessing this is a total n00b question, but a little help would... uh, help.

Thanks!
Aaron.
trollacious (Programmer)
1 Nov 07 22:38
aaronvegh (TechnicalUser)
1 Nov 07 23:21
Ah, good search! That did it. For the kids at home, the FILE type actually requires a connected resource via the fopen() call. So you can't simply declare a variable of type FILE; you have to then use it to open a file.

FILE *realFile = fopen(theFile, "r");
blockPrint(realFile, block, BITSPERBLOCK, "PT");

Cheers!
Aaron.
ArkM (IS/IT--Management)
2 Nov 07 2:29
Strictly speaking, in C the FILE type is a library defined (in stdio.h header) type alias (see typedef keyword). No need to use FILE type as such, only FILE* (pointer to FILE) type. It's (one of;) C language funny idioms.
As usually, FILE type alias denotes library defined structure, but don't use its members directly (it's implementation dependent entity).

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close