line « fgets « C File Q&A

Home
C File Q&A
1.array
2.binary
3.delete
4.Development
5.directory
6.fgets
7.fopen
8.fprintf
9.fscanf
10.fwrite
11.header
12.include
13.input
14.LINE
15.linux
16.open
17.output
18.pointer
19.read
20.size
21.string
22.struct
23.Text
24.windows
25.write
C File Q&A » fgets » line 

1. How to retrieve data and not entire lines in C?    stackoverflow.com

Right now I use:

    char    record[BUFLEN];
    if(fgets(record, BUFLEN, fp) != NULL) {

      /* some code */

  ...

2. insert text inside a line    stackoverflow.com

I have a file pointer which I am using with fgets() to give me a complete line along with the new line in the buffer. I want to replace 1 char and ...

3. fgets - is ommiting the last line in c    stackoverflow.com

Basically i am having problems with my code - this is homework so would rather not post it in here for obvious reasons. If it becomes truely important for me to ...

4. reading in lines of text from file    stackoverflow.com

gcc 4.5.1 c89 I am using the following code to read in a line of text from a configuration file. The configuration file is small at the moment, will grow with new ...

5. How to fgets() a specific line from a file in C?    stackoverflow.com

So, I'm trying to find a way to fgets() a specific line in a text file in C, to copy the contents of the line into a more permanent buffer: Essentially, I ...

6. Question regarding fgets and new lines    bytes.com

I need to read in a comma separated file, and for this I was going to use fgets. I was reading about it at http://www.cplusplus.com/ref/ and I noticed that the document said: "Reads characters from stream and stores them in string until (num -1) characters have been read or a newline or EOF character is reached, whichever comes first." My question ...

7. Problem with fgets reading last line over and over    bytes.com

Trond Valen writes: [color=blue] > Hi! > > Anyone who knows what the reason might be? fgets is supposed to return > null when reading EOF. I have a test for this, so my while loop should > exit, but it doesn't ...[/color] You forgot to post any code illustrating the observed behavior, so it is very difficult to know ...

8. reading line by from file without fgets    cboard.cprogramming.com

9. Skipping one line using fgets    cboard.cprogramming.com

10. fgets skipping lines    cboard.cprogramming.com

11. fgets reading the same line twice    cboard.cprogramming.com

I have a piece of code that processes a file to get certain values out of it. Basically the input file is formatted like this: x y d (over multiple lines) x and y are positive integers and d is N, E, S or W. In my code are a few bits relating to errors. If you think they're relevent, ask, ...

12. Start fgets at nth line?    cboard.cprogramming.com

There is no standard way to do that - if you know the size of your lines, it is POSSIBLE that you could use fseek() to get to the nth line. But the common way to get to the nth line is to simply read n lines using (for example) fgets. Edit: And before someone else points it out, yes, fseek() ...

13. fgets and skipping a line...    cboard.cprogramming.com

14. Mac - Default Lines Endings - fgets() - no worky    cboard.cprogramming.com

I'm on a Mac running Tiger. I use TextWrangler for basic editing of text files and scripts. I created a simple 2 line text file and saved it with TextWrangler's Text Files encodings set up for Windows (CRLF). My C program does a fgets(). In the Xcode debugger, I see that the first line has a \r\n as the line endings, ...

15. fgets and new line    cboard.cprogramming.com

16. help with fgets and assigning line to variable    cboard.cprogramming.com

hey there... i'm pretty new to c too, but i've had to do a similar thing when i was sending configuration strings to a gps... but anyway, check this out... works for me. Code: #include #include void main(void) { FILE *cfgfile; int maxline = 256; int i=0, j=0; char cfgstring[16][256]; cfgfile = fopen("strings.txt", "r"); if (cfgfile==NULL) printf("can't open file\n"); ...

18. combine two txt file line by line using fgets    daniweb.com

#include int main() { char c[78]; /* declare a char array */ char d[6]; char e[90]; FILE *file,*filep,*file2; /* declare a FILE pointer */ file = fopen("data.txt", "r"); file2 = fopen("data2.txt", "r"); filep = fopen("dataprint.txt","w+"); /* open a text file for reading */ while(fgets(c, 78, file)!=NULL && fgets (d,6,file2)!=NULL) { concat (e,d,c);//fist attempt fprintf(filep,"%s",e); //fprintf(filep,"%s %s",d,c); //second attempt } printf("\n\nClosing ...

19. make fgets() wait for new lines.    daniweb.com

java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.