I used the write function to write some stuff into a file. now i want to insert a blank link into the file before the next write function, do anyone know ...
I'm working in C and I need to write certain output values to a text file. These values will be written to the file at different points of the script.
I'm talking ...
I was trying to write a code in c after long time, objective of program is to
1) print the last 10 lines of text file which is received as arguements.
2) ...
I am in the planning stages of a project I am going to be building and for one part I am going to need it to write a string to a file one line at a time. The overall goal is for it to write one line each time the program is run.(Similar to storing "High Scores" in a game.) I ...
Code: #include #include #include #define LINES 4096 /* function prototype for percentage calculation */ void percentage_calculation_numbers(char*, int, char*); /* function prototype to count the number of characters in a string */ int countchar (char []); /* function prototype to find the first and last letter in the word */ char find_letter (char* a, char* b); char red; /* ...
Code: void genCfg(int err) { // create a buffer to read the allInOne.cfg. char buf[512]; char linesbuf[2048];; // declare the variables we will use in this function // open temporary file cotaining the data FILE *f = fopen("/var/etc/allInOne.cfg", "rt"); if (f) { while (fgets(buf, 512, f) { // if we found this string the we can stop to read and create ...
I can see your problem is solved but just as a comment... When you dont know something, you can always create a function that does what you need and then call it later everytime you need it. Sonner or later we all find something that cant be done by using some library function... Thats why I normally try to understand and ...
I'm not ignoring your suggestion(s), I know that will work, but not for how the program works. Ex. I don't want the user to have to write \\n into the buffer, I want him/her to be able to write \n and it actually write "\n" and not a new line. Do you know how I can do that?
Sorry ive fixed it now lol. The first entry never got entered with a new line becuase at first I didnt put "\n" in the code. Once I started to add more entries newlines started to go in. Just had to delete the database to put the newline in inbetween the first and second entry. Thanks for your help.
I am writing a C program that writes to a text file. When I try to write a new line character, '\n', to the file it doesn't work. I just get a random character where the new line would have been. I am using the fputc() function. I have tried using the hexadecimal equivalents, '\x0A' and '\x0D' but I get the ...