Note that there are some explanatory texts on larger screens.

plurals
  1. POReplace line breaks with single space in C
    primarykey
    data
    text
    <p>I am not able to replace the line breaks in a file with a single space. Say for example the file contains</p> <blockquote> <p>A book is a set or collection of written, printed, illustrated, or blank sheets, made of paper, parchment, or other various material.<br> Books may also refer to works of literature, or a main division of such a work. In library and information science, a book is called a monograph.<br> A store where books are bought and sold is a bookstore or bookshop. Books can also be borrowed from libraries.</p> </blockquote> <p>There is a line break at the start of the sentence(A book is a set....) and again there is a line break before starting the next line(Books may also refer..)</p> <p>I need this line break to replaced with a single space as follows </p> <blockquote> <p>A book is a set or collection of written, printed, illustrated, or blank sheets, made of paper, parchment, or other various material, usually fastened together to hinge at one side.Books may also refer to works of literature, or a main division of such a work. In library and information science, a book is called a monograph.A store where books are bought and sold is a bookstore or bookshop. Books can also be borrowed from libraries.</p> </blockquote> <p>The contents will be in .csv file . At code level, I will be reading the file. So while reading the file using fgets how to hanle the line breaks. This is the way I would be reading the contents of the file.</p> <pre><code>int FileRead(char *inputfile) { char buf[400]; if ((fileinfo=fopen(inputfile,"r"))==NULL) /* read header row and ignore it */ if (fgets(buf,400,fileinfo)!=NULL) { printf("read row"); rowsread ++; } else { fclose(fileinfo); return; } while (fgets(buf,400,fileinfo)!=NULL) /* read till EOF */ { rowsread ++; ............ ............ ............ </code></pre> <p>Could anyone please help me out on this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload