Russian Qt Forum
Май 06, 2024, 03:08 *
Добро пожаловать, Гость. Пожалуйста, войдите или зарегистрируйтесь.
Вам не пришло письмо с кодом активации?

Войти
 
  Начало   Форум  WIKI (Вики)FAQ Помощь Поиск Войти Регистрация  

Страниц: [1]   Вниз
  Печать  
Автор Тема: Проблема с передачей пути констольной проге  (Прочитано 6071 раз)
Admin
Administrator
Джедай : наставник для всех
*****
Offline Offline

Сообщений: 1988



Просмотр профиля
« : Ноябрь 03, 2005, 10:29 »

Есть программа
test.exe

У нее есть куча параметров, один из них -c путь к конфигурации

когда я использую test.exe -c C:\test\test.conf все путем

а когда я использую test.exe -c C:\Progrаm Files\test.conf то точто после пробела невидится , остается только C:\Progrаm

Ковычки не помогают, как бы передать такой путь программе
Записан
Steven_Orko
Гость
« Ответ #1 : Февраль 07, 2006, 08:15 »

Если тема еще актуальна, то записать его в кратком формате DOS.

The GetShortPathName function retrieves the short path form of the specified path.

Код:

DWORD GetShortPathName(
  LPCTSTR lpszLongPath,
  LPTSTR lpszShortPath,
  DWORD cchBuffer
);


Parameters
lpszLongPath
Цитировать
[in] Pointer to a null-terminated path string. The function retrieves the short form of this path.
In the ANSI version of this function, the name is limited to MAX_PATH characters. To extend this limit to 32,767 wide characters, call the Unicode version of the function and prepend "\\?\" to the path. For more information, see Naming a File.


Windows Me/98/95:  This string must not exceed MAX_PATH characters.
lpszShortPath
Цитировать
[out] Pointer to a buffer to receive the null-terminated short form of the path specified by lpszLongPath.

cchBuffer
Цитировать
[in] Size of the buffer pointed to by lpszShortPath, in TCHARs.

Return Values
If the function succeeds, the return value is the length, in TCHARs, of the string copied to lpszShortPath, not including the terminating null character.

If the lpszShortPath buffer is too small to contain the path, the return value is the size of the buffer, in TCHARs, required to hold the path. Therefore, if the return value is greater than cchBuffer, call the function again with a buffer that is large enough to hold the path.

If the function fails for any other reason, the return value is zero. To get extended error information, call GetLastError.

Remarks
When an application calls this function and specifies a path on a volume that does not support 8.3 aliases, the function fails with ERROR_INVALID_PARAMETER if the path is longer than 67 bytes.

The path specified by lpszLongPath does not have to be a full or a long path. The short form may be longer than the specified path.

If the specified path is already in its short form, there is no need for any conversion, and the function simply copies the specified path to the buffer for the short path.

You can set lpszShortPath to the same value as lpszLongPath; in other words, you can set the buffer for the short path to the address of the input path string.

You can obtain the long name of a file from the short name by calling the GetLongPathName function. Alternatively, where GetLongPathName is not available, you can call FindFirstFile on each component of the path to get the corresponding long name.
Записан
Admin
Administrator
Джедай : наставник для всех
*****
Offline Offline

Сообщений: 1988



Просмотр профиля
« Ответ #2 : Февраль 07, 2006, 10:55 »

спасибо!
наша прога должна работать под win и linux
значит часть win придется малость переделать
Записан
Страниц: [1]   Вверх
  Печать  
 
Перейти в:  


Страница сгенерирована за 0.05 секунд. Запросов: 22.