Skip to main content

Questions tagged [fgets]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer

PSET4: fgets returns odd characters instead of what's in .raw

I know the first few lines of 'card.raw' are (by opening in a texteditor): ˇÿˇ‡JFIFHHˇ€Cˇ€Cˇ¿Vˇƒ Currently all I want the app to do is print back what's in the .raw file, and then ...
3 votes
1 answer

pset2 Crack - Looping through fgets

I'm trying to loop through a text file (seven lines in the file, with aaaa, aaab, aaac, etc listed) with password guesses for pset2 Crack. I am able to open the file, and iterate through the lines. ...
0 votes
1 answer

malloc and fgets

#include<stdio.h> #include<cs50.h> int main(void) { char* s= malloc(sizeof(char)*5)); //allocating 5 bytes fgets(s,6,stdin); //allocating 5 bytes for hello and 1 byte for '\0'...
1 vote
1 answer

Help with fseek and fgets

I am trying to fully grasp how these functions work. From the Reference50 website: fseek FILE* out = fopen("out.txt", "w+"); fputs("Team Bowden Fever!", out); char buffer[50]; fseek(out, 0, ...