Click here to Skip to main content
14,357,666 members

C / C++ / MFC

 
GeneralRe: Simple anti virus project (Argv FILE* dirent.h) Pin
Richard MacCutchan25-May-15 4:25
protectorRichard MacCutchan25-May-15 4:25 
GeneralRe: Simple anti virus project (Argv FILE* dirent.h) Pin
a random user25-May-15 4:34
membera random user25-May-15 4:34 
QuestionC language Help using Dirent.h Pin
a random user22-May-15 7:24
membera random user22-May-15 7:24 
SuggestionRe: C language Help using Dirent.h Pin
Richard MacCutchan22-May-15 8:19
protectorRichard MacCutchan22-May-15 8:19 
AnswerRe: C language Help using Dirent.h Pin
k505422-May-15 8:37
memberk505422-May-15 8:37 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 2:06
membera random user23-May-15 2:06 
GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan23-May-15 3:15
protectorRichard MacCutchan23-May-15 3:15 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 3:56
membera random user23-May-15 3:56 
thank you but atm im trying to figure out how to open the folder that contains the folder that I entered in argv

because its a fodler inside a folder that contains files

as you can see it doesnt work






int count = 0, size = 0, totalDirs = 0,location = 0;
int sizes[3],flag = 0;
int secSpot = 0;



int argvSize, spot = 0;
char c;

argvSize = strlen(argv[1]);

for (int i = 0; i < argvSize; i++)
{

if (argv[1][i] == '/')
{
spot++;

}

}



for (int i = 0; i < argvSize; i++)
{

if (argv[1][i] == '/')
{
if (secSpot != spot)
{
secSpot++;

}
else if ((secSpot == spot) && (flag == 0))
{
location = i;
flag++;

}
}
}


location--;


char* entrenceToTheFolderBefore = (char*)malloc(sizeof(char)*location);

for (int i = 0; i < location; i++)
{
entrenceToTheFolderBefore[i] = argv[1][i];
}


puts(entrenceToTheFolderBefore);


free(entrenceToTheFolderBefore);

modified 23-May-15 9:06am.

GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan23-May-15 4:04
protectorRichard MacCutchan23-May-15 4:04 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 4:08
membera random user23-May-15 4:08 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 4:45
membera random user23-May-15 4:45 
GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan23-May-15 7:27
protectorRichard MacCutchan23-May-15 7:27 
QuestionRe: C language Help using Dirent.h Pin
a random user23-May-15 10:47
membera random user23-May-15 10:47 
AnswerRe: C language Help using Dirent.h Pin
Richard MacCutchan23-May-15 21:58
protectorRichard MacCutchan23-May-15 21:58 
GeneralRe: C language Help using Dirent.h Pin
a random user24-May-15 0:05
membera random user24-May-15 0:05 
GeneralRe: C language Help using Dirent.h Pin
a random user24-May-15 0:19
membera random user24-May-15 0:19 
GeneralRe: C language Help using Dirent.h Pin
a random user24-May-15 3:08
membera random user24-May-15 3:08 
GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan24-May-15 3:19
protectorRichard MacCutchan24-May-15 3:19 
GeneralRe: C language Help using Dirent.h Pin
a random user24-May-15 3:51
membera random user24-May-15 3:51 
GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan24-May-15 4:08
protectorRichard MacCutchan24-May-15 4:08 
GeneralRe: C language Help using Dirent.h Pin
a random user24-May-15 5:08
membera random user24-May-15 5:08 
GeneralRe: C language Help using Dirent.h Pin
a random user24-May-15 6:17
membera random user24-May-15 6:17 
GeneralRe: C language Help using Dirent.h Pin
David Crow26-May-15 3:53
memberDavid Crow26-May-15 3:53 
GeneralRe: C language Help using Dirent.h Pin
David Crow26-May-15 3:51
memberDavid Crow26-May-15 3:51 
QuestionRe: C language Help using Dirent.h Pin
David Crow26-May-15 4:49
memberDavid Crow26-May-15 4:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.