Questions tagged [fputs]

Anything related to C or C++ standard library functions `fputs` (C) or `std::fputs` (C++). These functions are used to write a null-terminated string to an output stream.

Anything related to C or C++ standard library functions fputs (defined in <stdio.h> C standard header) or std::fputs (defined in <cstdio> C++ standard header). These functions are used to write a null-terminated string to an output stream.

See CPPreference.com:

123 questions
1
vote
3 answers

Searching for specific words in a text file

HI guys havent been able to find how to search for specific words in a text file anywhere, so here it goes, this is what I have now and just read and prints the entire text file. #include #include #include int main…
Winkz
  • 329
  • 2
  • 5
  • 19
1
vote
1 answer

Send Backspace or Delete using Telnet in PHP

I'm using this nice piece of code to connect to a Telnet session and send it some commands and get the output. http://www.geckotribe.com/php-telnet/ I'm running into an problem now in that I want to remove some data in the Telnet session and…
Haru
  • 1,361
  • 2
  • 15
  • 40
0
votes
1 answer

How to write to file with most recent record first

I have code that runs once daily and fputs() appends a daily log entry to a flat file in the format: yyyy-mm-dd|log entry This file is then displayed by a web page that fgets() and displays all records from oldest to newest. What I need to do is…
user191688
  • 2,609
  • 5
  • 26
  • 30
0
votes
1 answer

newsgroup nntp protocol talk with fsockopen - how to get size

In the code below I can get a list of "message-id"s in a group I selected earlier. Now with that info I can retreive the header with head "message-ID" how do I find out what the size of the article is? Like what php imap does with…
renevdkooi
  • 1,515
  • 1
  • 17
  • 42
0
votes
3 answers

C Program terminates after if/else or repeats if I use fputs/fgets

I am very new to C and have dabbled in Objective-C, AppleScript, and HTML/CSS. I'm sure that my problem is very easy to solve. I am trying to write something that will allow me to input source data and have it ordered in a certain way as output (in…
Sneagan
  • 43
  • 1
  • 1
  • 5
0
votes
2 answers

Implementing 'cat' in c - wwwmc? (What's wrong with my code)

My code works fine in a way. I have two issues with it though. One, at the end of printing the files to the standard output, it gives me a segmentation fault. Two, I can't use fputs to print out the data because I get a segmentation fault right…
jonalmeida
  • 1,206
  • 1
  • 9
  • 24
0
votes
2 answers

PHP processes a CSV file into 19 Smaller CSV's very slow

I have created this php script which takes a very long time to filter the CSV file into 19 smaller ones. The link for the CSV's is within this google drive…
grimx
  • 5
  • 3
0
votes
0 answers

I have got struck in a problem where I have the task to update the old line with a new line in a .txt file using C

I have opened the file in "r+" mode and tried to use fputs to replace old_line (line) with new_line (updated_line) char updated_line[] = "Hello This was ABCD"; fseek(fp, -(strlen(line))-1, SEEK_CUR); fputs(updated_line, fp); Given txt file data…
Vinay K
  • 1
  • 1
0
votes
3 answers

How does Visual Studio Code handle the fputs statement for File I/O in "r+" mode?

I have written a code #include #include int main() { FILE *fp; fp=fopen("lets.txt","r+"); if(fp==NULL) { printf("ERROR"); exit(1); } else { char ch,ch1; …
Tar
  • 15
  • 5
0
votes
1 answer

SMTP does not send HTML message

Good morning, I'm trying to send SMTP mail with HTML message. But not this gets the message. So I did a test. Text messages sent successfully. Html message and sends it with little success. And server problem that is not accepting my post…
user628298
  • 287
  • 2
  • 14
0
votes
1 answer

Why when read and write performed back to back in file opened in rb+ mode behaves not as expected in c language

I opened a file in rb+ mode successfuly Wrote two strings using two fputs. File ptr moved to 3 byte from file beginning using fseek. Read four characters successfuly using fgets. Now when I tried to write third string using fputs I am unable to do…
0
votes
0 answers

How to copy my file on disk after receive from a socket in C?

I'm programming a server with C and I send file with my client. I receive the file with my server and i want to write it on disk. I print it to be sure i had it. Everything are ok but when i write on disk, it's doesn't write everything. This is a…
0
votes
3 answers

Print char array with fputs or other - C

The first array prints all right. test[] = However, when the array is like in the second example, test[][] ={"...","..."}; I get an incompatible warning. In the second example with fputs, it prints without a line break and with printf, nothing…
Cmistry
  • 173
  • 7
0
votes
5 answers

How to write to file from char[][]?

I am gathering data into a char[][] array, then let a user choose which of those string to write to a file. So I'm doing for example char arr[3][3]; // assume there are three different two-char long strings in there FILE* f = fopen("file",…
Cobra_Fast
  • 15,671
  • 8
  • 57
  • 102
0
votes
1 answer

Downloading file, changing extension and merging into 1 file

Trying to download files via the URL, rename from the .ADM extension to .txt then put contents of each file into a single txt file However its saying the fputs param 2 is a resource The $logfile['name'] is the filename thats stored in the…
ChrisYates
  • 31
  • 5
1 2 3
8 9