Let me explain in more detail. I'm trying to write a program that downloads a 
file from a remote FTP server, appends one line to the end of it, and then 
re-uploads it (this is for a program that manages music collections - when a 
new song is added, it downloads a song list from the main server and adds a 
string with song information). The file operations work, and the necessary 
string is appended to the file and re-uploaded, but when I download the file 
again, no text was appended. In other words, the file on the FTP server 
contains only the most recently written string from the last execution of the 
program, and not any prior strings from prior runs of the program. I've written 
a small test program to demonstrate this; here's the code at Pastebin:

http://pastebin.com/r07TkxEK

The program prints the following output on both the initial run and subsequent 
runs:

Remote URL: ftp://orangesquirrels.com
Got data.
Local data file size: 678 bytes.
Current position in file: 678
Uploading database file back to server...
Local data file size: 690 bytes.
Remote URL is ftp://orangesquirrels.com !
*** We read 690 bytes from file.
If the program works, the output from the subsequent run should be:

Remote URL: ftp://orangesquirrels.com
Got data.
Local data file size: 690 bytes.
Current position in file: 690
Uploading database file back to server...
Local data file size: 702 bytes.
Remote URL is ftp://orangesquirrels.com !
*** We read 702 bytes from file.

And the local data file size should be incrementing by 12 each run (12 is the 
length of the sample string I'm using in this test program), but it's not - it 
remains 690 bytes (which is the size of the remote directory listing 
mysteriously getting tagged onto the front of the file).
Because the data is written to the file and re-uploaded (I know this because 
the uploaded file is a greater size than the downloaded file) I assume the 
upload worked; my suspicion is that the problem lies in the download process 
and/or the curl_database_write function. I've been doing everything humanely 
possible to find out why this is happening, to no avail. If anyone knows 
anything about why this isn't working, I'd love to know. I'm being paid to 
write this program, and I know I've got to find a solution soon...
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to