|
Boost Users : |
Subject: [Boost-users] creating cd... or set def... with boost "filesystem"
From: M (meirab_at_[hidden])
Date: 2008-10-28 18:06:22
hello all
---------
there is a need to creating "cd..." or "set def..." with boost "filesystem"
and make it transparent to windows\linux.
there is a need to create one line of "filesystem" command.
i don't know if there is a "wish list" or "to do list for a future
version" - but it is needed - and sooner the better.
today we have (for windows):
--------------------------------------------------------------------------------------------------------------------
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
#include <string>
using namespace std;
#include <atlstr.h>
int main(void)
{
FILE *fp;
CString dir = L"D:/schmidt26_cpp/mpi/debug"; // construct from a
LPCWSTR
//Set the current directory.
SetCurrentDirectory( dir );
fp = _popen("DIR", "r");
if (fp != NULL) {
char buffer[BUFSIZ];
while (fgets(buffer, sizeof buffer, fp) != NULL)
fputs(buffer, stdout);
}
return 0;
}
--------------------------------------------------------------------------------------------------------------------
and for linux (posix):
#include<stdio.h>
#include <unistd.h>
int main()
{
// D:\schmidt26_cpp\mpi\debug
if(chdir("/home/kot/Desktop") != -1)
printf("Successfully changed directory to Desktop!\n");
else printf("Error changing directory!\n");
/*
if(fork())
execl("/usr/bin/xterm", "-e", "/usr/bin/emacs", (char*)0);
else
printf("Close the pop-up window first!\n");
wait(NULL);
*/
return 0;
}
--------------------------------------------------------------------------------------------------------------------
thank's all.
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net