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

  • Home
  • SEARCH
  • 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 6816107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:53:11+00:00 2026-05-26T20:53:11+00:00

FILE *new = fopen(new.out, w+); // creates a new file that didnt exist before

  • 0
FILE *new = fopen("new.out", "w+"); // creates a new file that didnt exist before
char finput[50];

fprintf(new, "hello\nworld\n");

while(fgets(finput, 51, new) != NULL)
{ /*never reaches this point*/ }

What am I doing wrong? If I write to a file that doesn’t already exist, is it possible to read from that file later on?

  • 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-05-26T20:53:11+00:00Added an answer on May 26, 2026 at 8:53 pm

    You should rewind or fseek before reading again. And please, don’t call a variable new (because that is a C++ keyword).

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

Sidebar

Related Questions

this code creates a csv file. However, I have avoided printing out commas in
In VS2008, I go to File/New/Project, select ASP.NET Web Application and create a new
File file = new File(file-type-string-i-want-2000-01-01-01-01-01.conf.gz); Matcher matcher = pattern.compile(\\-(.*)\\-\\d{4})).matcher(fileName); StringBuilder sb = new StringBuilder();
I added a new file F1 and made changes to another file F2 but
I just did File -> New Project last night on a new project. Ah,
PhoneGap - How to create a new file in assets/www/example/hallo.text my error is Error
Im trying to create new file on D: drive with c/c++ I found this
I try to create a new file inside a JSP and try to save
This is my code: File TempFiles = new File(Tempfilepath); if (TempFiles.exists()) { String[] child
I am trying to make a new file format for music. It needs to

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.