cURL / Mailing Lists / curl-library / Single Mail


Retrieving text from a Windows server as a Mac format file?

From: Armando Miguel Cerasoli Quintero <>
Date: Thu, 19 May 2011 20:44:45 +0000

Hi there...
So... I'm trying to retrieve my "scores" file from the server, but I'm getting an extra "Carriage return" sequence.
I'm saving again the file on my PC using a normal ofstream to check it.
Notepad says it's a Macintosh file... But I think there is something wrong when I manipulate the data...
This is the original file: is what I get: then when I show it on my game:
This is what I'm doing:
  void tabla_tiempos(ALLEGRO_USTR *array[15]){
     CURL *curl; CURLcode res; curl = curl_easy_init();
     std::string string;
        curl_easy_setopt(curl, CURLOPT_URL, ""); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "name=lll˝˝˝&project=curl"); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data); ///Here I'm calling the Function write_data. curl_easy_setopt(curl, CURLOPT_WRITEDATA, &string);
        res = curl_easy_perform(curl); curl_easy_cleanup(curl);

  static size_t write_data(void *buffer/*The data*/, size_t size, size_t nmemb, std::string *userp){
     size_t n = size * nmemb; userp->append((char *)buffer, n);
     std::ofstream outfile ("check_it.txt"); outfile.write ((char *)buffer, 50); outfile.close();
     return n;

And this is what the game shows:
I don't know in which step I'm adding that extra CR
And the PHP script:

<?php$myFile = "scores";$fh = fopen($myFile, 'r');$theData = fread($fh, filesize($myFile));fclose($fh);echo $theData;?>

Thank in advance...

List admin:
Received on 2011-05-19