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 7004833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:15:00+00:00 2026-05-27T21:15:00+00:00

Using the C language, I am trying to manipulate some files generated by openssl

  • 0

Using the C language, I am trying to manipulate some files generated by openssl and containing a lot of (very) special characters. But the end of file seems to be prematurely detected.
For example see an extract of my program, that is supposed to copy a file to another :

(for simplicity reasons I do not show the test of the opening of the file but I do that in my program)

char msgcrypt[FFILE];
FILE* fMsg = fopen(f4Path,"r");
while(fgets(tmp,FFILE,fMsg) != NULL) strcat(msgcrypt,tmp);
fclose(fMsg);
FILE* fMsg2 = fopen(f5Path,"w");
fprintf(fMsg2,"%s",msgcrypt);
fclose(fMsg2);

here is the content of the file located at f4Path :

Salted__X¢~xÁïÈú™xe^„fl¯�˜<åD

now the content of the file located at f5Path :

Salted__X¢~xÁïÈú™xe^„fl¯

Notice that 4 characters are missing.

Do someone have an idea?

  • 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-27T21:15:01+00:00Added an answer on May 27, 2026 at 9:15 pm

    But the end of file seems to be prematurely detected

    Sounds familiar.

    • Use fopen(f4Path, "rb") when opening the file. This has real significance on Windows.
    • Don’t use string functions (fprintf, strcat, fgets etc) they will choke on NUL characters. Use fread and fwrite instead.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to code a flowchart generator for a language using Ruby. I
I'm trying to get my feet wet with MIPS assembly language using the MARS
So I am using a scripting language with c++-like syntax, and I am trying
I have been trying to detect the browser language preference using JavaScript. If I
I'm trying to access user's language preference w/o using server code. I'm looking for
I'm trying to render a template in a different language using i18n. I did
I'm trying to find the physical location of a computer using a language like
I'm trying to POST some data as if I was using FORM on HTML
I'm trying to select some text using regular expressions leaving all img tags intact.
I'm trying to create a Textmate snippet, but have run into some difficulties. Basically,

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.