| |
| |
| |
|
Comments:
<0> bye <1> moin <0> hello <2> hi <0> laters <3> hi, what is wrong with these two lines of code? i included stdio.h and these 2 lines are copied straight from a book.File *a3; <3> a3 = fopen("o8-a-10K","r");
<4> its "FILE *", not "File *" <3> oh <3> rofl <3> thx <5> I guess editor screwed it up :) <6> or printer <6> sheesh... dead man soundtrack is so good... <3> hell yeah <3> neil young ftw <3> is there a function for reading a line? all i see is getc() <6> fgets <6> just read... <3> its not makign any sense : ( <3> according to what i've read, the only way to do it is to go throgh a line character by character. this is fine, im just wondering if i can do it 1 whole line at a time <5> yithkai: fgets <5> yithkai: if it's a text file, that is <3> so fgets returns a char array? <7> yithkai, google for "man fgets" <3> alright i got fgets to work but i have another question <3> how do i get fgets to get the next line? i tried copying the same code twice and it gave back the same first line both times <7> fgets won't read the same line twice, unless the input has it twice. <7> you may paste your code to http://rafb.net/paste so that we can stop guessing. <3> k thx <3> hold on <3> http://rafb.net/p/Fi3DOS73.html <7> uh, that's quite horrible.
<7> no indentation first of all. <3> : ) <3> i use java <7> anyway, length of s is 5, but LENGTH is 6, what's up with that? <7> java needs indentation too. <3> it says on the wikipedia entry for fgets that you need to add 1 to the length for the new line character to be counted <7> I suggest you use a longer buffer. <7> right, so do you think that you should tell fgets that the buffer is longer than it actually is? <3> yeah. the file might be 4.561, but its really 4.561\n right? <7> like when you are backing up a car and some dude tell you there's still 10 meters of room, except that there isn't. <3> well changing length to 5 doesnt do it either : \ <3> i'll try 10 <3> hey that worked <3> why is that <7> LENGTH and size of s should match. <3> that didnt work though <7> so that you won't get a segmentation fault and have the program crash and burn. <3> come again? <7> C is language that will maim you if you don't know what you are doing. <3> yeah <3> i think i can get by without using pointers and all of that stuff that java didnt teach me <3> im doing a very simple project <7> not really. <7> first of all, the first parameter to fgets is a pointer to char, and the third one is a pointer to FILE. <3> yeah but that i can just copy from a textbook <7> setting LENGTH to 5 and having s[5] "didn't work" because the '\n' did not fit the buffer and was read on the second call. <7> although I don't know that your actual input is. <3> right, like i said before <0> laters
Return to
#c or Go to some related
logs:
#worldchat #nuernberg #worldchat dragonfly povi lyrics #nuernberg #worldchat #sicilia #worldchat #london #sicilia
|
|