- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
In the Qwin app I working on I use GetOpenFilename. The full path filename chosen goes to fname, a character*255 variable declared in a module.
To manipulate fname I use L=LEN_TRIM(fname). Up to a few days ago L received the correct size of the filename, but after some changes I made in the program L is now always 255. I can't find what change I made that caused this. Another already working Qwin app uses the same scheme and is working well. The project settings of the new are the same of the old one (so I think, perhaps I am missing something).
Any hint about what is causing this problem?
Thanks
Geraldo
To manipulate fname I use L=LEN_TRIM(fname). Up to a few days ago L received the correct size of the filename, but after some changes I made in the program L is now always 255. I can't find what change I made that caused this. Another already working Qwin app uses the same scheme and is working well. The project settings of the new are the same of the old one (so I think, perhaps I am missing something).
Any hint about what is causing this problem?
Thanks
Geraldo
Ссылка скопирована
6 Ответы
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
LEN_TRIM gives the position of the last character that is not a space. Hence if you get any character that is not a space after the full path string, LEN_TRIM will pick that character, whether it normally displays or not. (Note that under debug, NO character after a CHAR(0) displays in the watch window.)
Either use a null-terminated string for the full path, and write a function eg LenCstr to find where the first CHAR(0) is, or write a function eg LenTrimAll to find the position of the last character that does not display. The first alternative is the safer bet.
Regards
Alan
Either use a null-terminated string for the full path, and write a function eg LenCstr to find where the first CHAR(0) is, or write a function eg LenTrimAll to find the position of the last character that does not display. The first alternative is the safer bet.
Regards
Alan
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Geraldo,
XFTLite package on my home page contains:
- XStrings.f90 module, with some handy functions when working with C-style functions (See e.g. CLEN -- basically it uses INDEX intrinsic to find length of C-style string)
- XFTFile.f90, with wrappers for common Open/Save/Browse dialogs, including C to Fotran strings conversion. The usage is as simple as:
XFTLite package on my home page contains:
- XStrings.f90 module, with some handy functions when working with C-style functions (See e.g. CLEN -- basically it uses INDEX intrinsic to find length of C-style string)
- XFTFile.f90, with wrappers for common Open/Save/Browse dialogs, including C to Fotran strings conversion. The usage is as simple as:
sDirName = "" !Current directory sFileName = "" IF (XGetOpenFile(hWnd, sDirName, nFiles, sFileName, & sTypes=(/"XYZ files (*.xyz)"/), sExts=(/"*.xyz"/))) THEN OPEN(42, FILE=TRIM(sDirName)//sFileName, ...Jugoslav
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
Alan and Jugoslav,
Thanks for your sugestions.
I will implement one of then ( the easiest one, I am rather lazy).
What amazes me is that LEN_TRIM was working ok in the new project an stoped working, and always worked in the older.
Thanks again
Geraldo
Thanks for your sugestions.
I will implement one of then ( the easiest one, I am rather lazy).
What amazes me is that LEN_TRIM was working ok in the new project an stoped working, and always worked in the older.
Thanks again
Geraldo
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
It may depend on uninitialized data.
Steve
Steve
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
I agree with HOST. When I faced a similar problem I initialized every bite in FNAME as a SPACE, i.e. ' ', and my program works correctly ever since.
- Отметить как новое
- Закладка
- Подписаться
- Отключить
- Подписка на RSS-канал
- Выделить
- Печать
- Сообщить о недопустимом содержимом
On the mark. In one of the many changes I made, I have commented the line: FNAME=''. Uncommenting it made things run ok again.
Thanks you all
Geraldo
Thanks you all
Geraldo
Ответить
Параметры темы
- Подписка на RSS-канал
- Отметить тему как новую
- Отметить тему как прочитанную
- Выполнить отслеживание данной Тема для текущего пользователя
- Закладка
- Подписаться
- Страница в формате печати