Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7787799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T20:47:09+00:00 2026-06-01T20:47:09+00:00

I have two questions. How to create a NSFileHandle object with the FILE* instance?

  • 0

I have two questions.

  1. How to create a NSFileHandle object with the FILE* instance?

  2. How to create a NSData object with the void* instance?

I am sorry there’s little information without context.

Just refer to my recent question. Weird behavior of fopen on ios I cannot use the native fopen function to create or to write the content into a file.

As a result, I just want to use the api in the ios framework and wrap the code of fopen and fwrite and such staff. So I should convert the FILE* object into NSFileHandle or something that can manipulate the file. Also the content which is handled with void* should be converted to the data format that can be accepted in the ios framework. And I think NSData should be the choice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T20:47:11+00:00Added an answer on June 1, 2026 at 8:47 pm

    As for FILE* to NSFileHandle, I found this mailing list question that perfectly matches what you need. Relevant code:

    FILE *fp;
    NSFileHandle *p;
    
    fp = fopen( "foo", "r");
    p = [[[NSFileHandle alloc] initWithFileDescriptor:fileno( fp)
    closeOnDealloc:YES] autorelease];
    

    And it comes with a lovely warning from the answerer:

    Be careful not to read from fp, because stdio caches.

    EDIT: As for void* to NSData, I think you want NSData's -initWithBytesNoCopy:Length:freeWhenDone:. See this related question on how to use it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two questions. I create movie player. This is my code: VideoView videoView
I have two questions... Could I create a complete portal for Internet with WSS
I have two questions. 1) I found a little gem of code for how
I have two questions regarding how to create / use the JDO persistence manager
I have two questions, How to create an overlay on a MKMapkitView from user's
I guess I have two questions actually: One: How do I create folders with
I have two questions: 1) I have a few global variables for my website
I have two questions: (1) I learned somewhere that -O3 is not recommended with
I have two questions: From personal experience, what free blog engine is the best
I have two questions about java.awt.Shape . Suppose I have two Shape s, shape1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.