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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:12:30+00:00 2026-05-15T19:12:30+00:00

Text file (or CSV) is: Data:,,,,,\n (but with 100 ,s) In C or C++

  • 0

Text file (or CSV) is:

Data:,,,,,\n  

(but with 100 “,”s)

In C or C++ I would like to open the file and then fill in values between the “,”.
i.e.- Data:,1,2,3,4,\n

I’m guessing that I need some sort of search to find the next comma, insert data, find the next comma insert, etc.

I was looking at memchr() for a buffer and was wondering if there is something similar for a text file?

If you could point me in the right direction, I would appreciate it.

(I don’t mind reading a book to find something out like this either, I just don’t know what book would have this information?)

Thank You.

  • 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-15T19:12:31+00:00Added an answer on May 15, 2026 at 7:12 pm

    You can’t actually do that in C… if you open in read/write mode you’ll overwrite characters, not insert them.

    http://c-faq.com/stdio/fupdate.html

    You need to open the file, read the line into memory, write the new line to a temp file.

    After you’re done inserting all the lines, copy the temp file over the original file. I don’t think there’s any other way to do it.

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

Sidebar

Related Questions

I have a relatively large csv/text data file (33mb) that I need to do
I have a csv file with dump data of table and I would like
I have to write huge data in text[csv] file. I used BufferedWriter to write
I have a simple java code that reads text csv file that contains sentences
I have a Python script that reads through a text csv file and creates
How should a (CSV?) text file be formatted so that it can be imported
I want to pre-append some text a a CSV file that is created by
We currently use Datastage ETL to - Export a CSV/text file with data from
I have a [SQL 2008] SSIS package that takes a CSV text file and
I've written a procedure to dump table data out to a text file like

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.