C++ Help,formatting a file path - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Other (
https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (
https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: C++ Help,formatting a file path (
/showthread.php?tid=261617)
C++ Help,formatting a file path -
SkizzoTrick - 14.06.2011
Hello,im inneed of some help because i just cannot find the answer
...
How do i format the directory of a file?I have this:
Код:
int main()
{
printf("Total created accounts: %d\n\n",files);
char Directory[64],Rasp[5],Nume[20],varsta,Localitate[20],Judet[20],Tara[20],Liceu[20];
printf("Whats your name?\n");
gets(Nume);
printf("\n\nWant to create the file?\n");
gets(Rasp);
printf("D:/gamer/Accounts/%s",Nume);
if(strcmp(Rasp,"Da") == 0)
{
FILE * pFile;
pFile = fopen ("D:/gamer/Accounts/Number","w");//Directory should be a string.
if (pFile!=NULL)
{
fputs ("Text",pFile);//ADD A STRING HERE
fclose (pFile);
files++;
}
}
else
{
printf("Sucker");
}
}
i want something like this:
pawn Код:
format(string,sizeof(string),"D:/Gamer/Accounts/%s",Nume);
pFile = fopen (string,"w");
Re: C++ Help,formatting a file path -
CrunkBankS - 14.06.2011
Usage format in C++
Re: C++ Help,formatting a file path -
SkizzoTrick - 14.06.2011
Quote:
Originally Posted by CrunkBankS
Usage format in C++
|
Unfortunatelly,format is not a C++ function,it is a SAMP one.
Re: C++ Help,formatting a file path -
kc - 14.06.2011
You should really post at a C++ forum for stuff like this, but sprintf is the C++ equivalent of format.
Re: C++ Help,formatting a file path -
SkizzoTrick - 14.06.2011
Quote:
Originally Posted by kc
You should really post at a C++ forum for stuff like this, but sprintf is the C++ equivalent of format.
|
Thanks alot
.I am sorry for posting here,im not going to post this type of topics here anymore.