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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:25:14+00:00 2026-06-09T15:25:14+00:00

I have an array and am able to print the portion of it that

  • 0

I have an array and am able to print the portion of it that I want. But what I would like to do is write that portion to a new array. Does anyone know how to do this?

Thanks in advance!

  char line[128];
  char *line1;
  char *pch,*pch1;

  char key[]="REMARK 290    ";
  char key1[]="X";



  int start=24;
  int len=35;

  while (fgets(line,sizeof line, file)!=NULL)

  {
      pch=strstr(line,key);
      pch1=strstr(line,key1);


      if(pch!=NULL && pch1!=NULL){

      printf("%.*s\n",len,line+start);

What gets printed at the end is what I want piped into a new array.

  • 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-09T15:25:15+00:00Added an answer on June 9, 2026 at 3:25 pm

    Pipes are used to communicate between processes. You can’t pipe from one array to another.

    If the printf() at the end of your code does what you want, then you simply want to use sprintf() to put the result of the “print” in an array instead of sending it to stdout.

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

Sidebar

Related Questions

I have my array displayed like it but I cant seems to be able
I have an array of files. I'd like to be able to break that
Say I have an array of objects that I want to be able to
I have an array structure like this, which I'm able to print out just
I have an array of CLLocation objects and I'd like to be able to
I have an array of objects, and want the objects to be able to
Any help is appreciated. I have an array that is forfetch like this. The
I have an Array that is in a class called MusicArray and I want
I have an array saved as a variable $custgalarr=explode(,,$custgallinks); If I print this like
I have an array that looks like this (the full list is here ):

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.