Yes! this looks to be a good replacement for DIR$(). I like that it comes in as string and you can get all the details or just file names.
@SpriggsySpriggs
Are there other switches? Probably have to leave it to Linux users to look up the ones they might need and I will ask you about the Windows ones ;-))
Also this doesn't seem to work if I add path to spec but that's OK, I guess. :)
I tried "C:\\*.*" and "..\*.*" the root and the directory just above current.Did you put "dir"?
I tried "C:\\*.*" and "..\*.*" the root and the directory just above current.
string pipecom_buffer;
const char* pipecom (char* cmd){
FILE* stream;
const int max_buffer = 256;
char buffer[max_buffer];
pipecom_buffer.clear();
stream = popen(cmd, "r");
if (stream) {
while (!feof(stream)) {
if (fgets(buffer, max_buffer, stream) != NULL) {
pipecom_buffer.append(buffer);
}
}
pclose(stream);
}
return pipecom_buffer.c_str();
}
It appears to work, but it relies on QB64's behaviour of (usually) making a copy of string data. There are cases where it doesn't copy (like if you do `LEN(pipecom("foo"))`) because the string is read-only and that's okay, but I can't verify that it'll be fine in all cases.That was the trick! "./" worked. I also tried "/home/name/QB64/source/program/" and that didn't take either. The wiki was not exactly clear either, but I tried.
You use the /P switch to have the Command Prompt pause results after it displays each screen. You have to press a key to continue viewing the next page of results. The command prompt window is hidden because of this it cannot receive input hence you cannot use /P.@mpgcan @badger Yes, you cannot do a command that will require user input. The same is true for a regular SHELL. This is meant to run a command and grab immediate output. You cannot interact with the program you are calling.