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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:51:58+00:00 2026-05-26T01:51:58+00:00

I am getting a newline character into a text file while I was writing

  • 0

I am getting a newline character into a text file while I was writing some content into the text file using the code below

sprintf(str,"GodownName,LorryNumber,InvoiceNumber,CementCompanyName,RcvdPrsnName,RcvdPrsNDsgnation,EntityQty,Date\0");
write(fd,str,strlen(str));

the text is writing from 2nd row and an unwanted newline is writing at 1st row. I want my text to be written from 1st row. So please any one help me to remove newline characters or spaces from text file

Thanks in advance

  • 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-26T01:51:59+00:00Added an answer on May 26, 2026 at 1:51 am

    My guess is that you have another function which writes in fd before the call of this function.

    Besides, writing "\0" at the end of a string litteral is useless, there’s already one.

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

Sidebar

Related Questions

I'm attempting to pass the contents of a file into a Webview. Using the
I've been doing some reading on mysqli_real_escape_string(), and, after getting my content properly escaped,
I am reading a java file into a JTextPane and some of the lines
Given a file of text, where the character I want to match are delimited
So the file I am importing into a ListBox looks like this (each newline
Using Xml Deserilization I am getting value back from xml file and store the
Getting started with NHibernate How can I generate identity fields in nHibernate using Hilo
Getting the above error in following code. How to rectify it. Thanks. Please look
The compile error I'm getting is newline in constant The error occurs where the
i'm trying to read a file into my python program and apply tokenizer on

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.