Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Otros entornos y lenguajes > C++ Builder
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 06-08-2013
giulichajari giulichajari is offline
Miembro
 
Registrado: nov 2012
Posts: 306
Poder: 12
giulichajari Va por buen camino
Post Problema con funcion

Tengo una funcion asociada a un boton y los respectivos componentes pero me da un error en la tercera linea, dice "Declaration syntax error", es en la linea

Código Delphi [-]
unsigned int Drivetype = GetDriveType(Drive.c_str ());

Código Delphi [-]
AnsiString temp;
AnsiString Drive = AnsiString(DriveComboBox1->Drive) //EditDrive->Text;
unsigned int Drivetype = GetDriveType(Drive.c_str ());
switch (drivetype)
{
case 1 : temp = “No root directory”; return;
case DRIVE_REMOVABLE : temp = “Removable”; break;
case DRIVE_FIXED : temp = “Fixed”; break;
case DRIVE_REMOTE : temp = “Remote (network) drive”; break;
case DRIVE_CDROM : temp = “CD-ROM”; break;
case DRIVE_RAMDISK : temp = “RAM disk”; break;
default: temp = “Unknown”; return;
}
LabelDriveType->Caption = temp;
temp = “”;
DWORD VolumeSerialNumber = 0;
DWORD MaximumComponentLength = 0;
DWORD FileSystemFlags = 0;
char * volumeinfo = new char[255];
volumeinfo[0] = 0;
char* FileSystemNameBuffer = new char[255];
FileSystemNameBuffer[0] = 0;
GetVolumeInformation (Drive.c_str (), volumeinfo,
CHAPTER 14 Win32 API Functional Areas 530
255, &VolumeSerialNumber,
&MaximumComponentLength, &FileSystemFlags, 
?FileSystemNameBuffer,255);
if (strlen(volumeinfo) != 0)
EditVolumeInfo->Text = volumeinfo ;
else
EditVolumeInfo->Text = “- no label -”;
//Translate integer to chars for serial number
char string1[35];
char string2[35];
if (VolumeSerialNumber > 0)
{
unsigned int bottom = (LOWORD(VolumeSerialNumber));
unsigned int top = (HIWORD(VolumeSerialNumber));
sprintf(string1,”%04X”,top);
sprintf(string2,”%04X”,bottom);
LabelSerialNum->Caption = AnsiString(string1) + “-” + AnsiString(string2);
}
else
LabelSerialNum->Caption = “- unknown -”;
if (MaximumComponentLength > 0)
LabelMaxComponentLength->Caption = AnsiString(MaximumComponentLength) + “
?characters”;
else
LabelMaxComponentLength->Caption = “- unknown -”;
if (strlen(FileSystemNameBuffer) != 0)
LabelFileSystemNameBuffer->Caption = FileSystemNameBuffer;
else
LabelFileSystemNameBuffer->Caption = “- unknown -”;
LabelFileSystemFlags->Caption = “”; //AnsiString(FileSystemFlags);
if (FileSystemFlags & FS_CASE_IS_PRESERVED)
temp += AnsiString(“Filename case is preserved.\n”);
if (FileSystemFlags & FS_CASE_SENSITIVE)
temp += AnsiString(“Lookup is case-sensitive.\n”);
if (FileSystemFlags & FS_UNICODE_STORED_ON_DISK)
temp += AnsiString(“Supports Unicode in filenames.\n”);
if (FileSystemFlags & FS_PERSISTENT_ACLS)
temp += AnsiString(“Preserves and enforces ACLs.\n”);
if (FileSystemFlags & FS_FILE_COMPRESSION)
System Services 531
LISTING 14.6 Continued
temp += AnsiString(“Supports file-based compression.\n”);
if (FileSystemFlags & FS_VOL_IS_COMPRESSED)
temp += AnsiString(“Volume is compressed. (i.e., DoubleSpace).\n”);
LabelFileSystemFlags->Caption = temp;
DWORD spc = 0; //Sectors per cluster
DWORD bps = 0; //Bytes per cluster
DWORD cluster = 0; //clusters
DWORD freeclust = 0; //freeclusters
GetDiskFreeSpace (Drive.c_str (),&spc,&bps,&freeclust,&cluster) ;
unsigned long v1 = (unsigned long)cluster;
unsigned long v2 = (unsigned long) spc;
unsigned long v3 = (unsigned long) bps;
unsigned long volsize = (v1 * v2)/1024 * v3;
LabelVolumeSize->Caption = AnsiString(FormatSize(volsize));
unsigned long free_bytes = (freeclust * spc)/1024 * bps;
LabelFreeSpace->Caption = AnsiString(FormatSize(free_bytes));
if (volsize > 0)
LabelUsed->Caption = AnsiString(((volsize - free_bytes) * 100) / volsize) +
?“ %”;
else
LabelUsed->Caption = “n/a”;
}


Al parecer es la funcion Drive.c_str la que da el problema pero no logro darme cuenta que pasa.

Muchas gracias..
Saludos
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
problema con funcion!! MOCOSO07 HTML, Javascript y otros 0 12-01-2009 16:39:40
Problema con una funcion Alliance Varios 5 09-10-2008 02:38:32
Problema con declaración de función vivamotos C++ Builder 1 25-04-2008 10:35:56
Problema con la funcion mail JulioGO PHP 2 26-09-2005 11:24:15
problema al llamar una función sgarrido Varios 3 27-07-2004 01:14:33


La franja horaria es GMT +2. Ahora son las 04:07:51.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi