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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:32:18+00:00 2026-06-16T13:32:18+00:00

I have 2 questions. I want to create an array of files in C.

  • 0

I have 2 questions.

I want to create an array of files in C. But I’m not sure whether I have to malloc the size before or not.Can I just use FILE** files as an array or do I have to malloc them before. And if I have to make space, do I need to reserve 4 bytes (x86)?

I have the variable “char extra[8] = { 0xAE00AF00B000B100 };” and I want to assign it to the end of another char array[24]. Is there a faster way of doing that without having to type in every value by hand or using a for loop.

char extra[8] = { 0xAE00AF00B000B100 };
// index is a random place in the string
name[index] = '\0';
i = 0;
if (index > 16) {
    for (i = 24-index; i < 8; i++) {
        index++;
        name[index] = extra[i];
        }
    }
else {
    name[17] = 0xAE;
    name[18] = 0x00;
    name[19] = 0xAF;
    name[20] = 0x00;
    name[21] = 0xB0;
    name[22] = 0x00;
    name[23] = 0xB1;
    name[24] = 0x00;
}

I need to add those extra bytes btw.

  • 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-16T13:32:19+00:00Added an answer on June 16, 2026 at 1:32 pm

    I want to create an array of files in C. But I’m not sure whether I
    have to malloc the size before or not.Can I just use FILE** files as
    an array or do I have to malloc them before. And if I have to make
    space, do I need to reserve 4 bytes (x86)?

    If you need to have an array of files, it is possible to use an array of pointers as follow:

    #include <stdio.h>
    
    FILE *array[NB_FILES];
    

    Or you can do it dynamically if NB_FILES is only known at runtime.

    #include <stdio.h>
    #include <stdlib.h>
    
    FILE **array = malloc(nb_files * sizeof *array);
    

    I have the variable “char extra[8] = { 0xAE00AF00B000B100 };” and I want to assign it to the end of another char array[24]. Is there a faster way of doing that without having to type in every value by hand or using a for loop.

    The standard C library provides the function memcpy, which is a builtin on many compiler (so it will be faster than a for loop).

    #include <string.h>
    
    char array[24];
    char extra[8];
    
    memcpy(array + sizeof array - sizeof extra - 1, extra, sizeof extra);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create some simple navigation in sencha touch 2. I have questions
I have read similar questions but they talk of AI models. What I want
I have a question regarding dependency injection. say i want to create a class
Question: I have to create a tablet application. In this i want to make
I have two questions. I want to send SMSes from a web-site in PHP
I have few questions, I want to show the alert window on my Update
I have 2 questions on kendo combobox change event. On change event I want
I want to automatically answer questions with Greasemonkey. I have the questions and answers,
Hey everyone, I want to start using Scheme and I have two questions. First,
Not sure about how to title this post. I just inherited a set of

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.