SORU
9 EYLÜL 2008, Salı


Nasıl C string dosya uzantısı

Bir dize "dosya adı."ne için uzatma parçası olun. conf

Çapraz platform bir çözüm istiyorum.

CEVAP
9 EYLÜL 2008, Salı


Bu çözüm çok basit.

#include <iostream>
#include<string>

int main()
{
  std::string fn = "filename.conf";
  if(fn.substr(fn.find_last_of(".")   1) == "conf") {
    std::cout << "Yes..." << std::endl;
  } else {
    std::cout << "No..." << std::endl;
  }
}

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • JamesAtiPhone

    JamesAtiPhon

    16 EYLÜL 2010
  • SDSARG3

    SDSARG3

    14 Mart 2009
  • Tire Rack

    Tire Rack

    31 Mayıs 2007