C++ Help,formatting a file path
#1

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");
Reply


Messages In This Thread
C++ Help,formatting a file path - by SkizzoTrick - 14.06.2011, 11:50
Re: C++ Help,formatting a file path - by CrunkBankS - 14.06.2011, 12:07
Re: C++ Help,formatting a file path - by SkizzoTrick - 14.06.2011, 13:34
Re: C++ Help,formatting a file path - by kc - 14.06.2011, 14:14
Re: C++ Help,formatting a file path - by SkizzoTrick - 14.06.2011, 14:28

Forum Jump:


Users browsing this thread: 1 Guest(s)