- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does anybody know if there is an equivalent to 'VERIFY' in C / C++?
Cheers,
Dan
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't believe there is a standard C function close to that name. I'll guess that you're looking for something akin to strcspn() or the Cobol verify, not the verify function which comes up under info. These string functions can be written in terms of INDEX(), and the efficiency could be fairly good with compilers which do some form of in-line expansion. You might be interested in what you could find with a Google search on Fortran INDEX().
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
nVerify = VERIFY(privid, VALID_CHARS)
DO WHILE (nVerify > 0)
privid(nVerify:nVerify) = '_'
nVerify = VERIFY(privid, VALID_CHARS)
END DO
DO WHILE (nVerify > 0)
privid(nVerify:nVerify) = '_'
nVerify = VERIFY(privid, VALID_CHARS)
END DO
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What I tried to say...I'm not to bothered about efficiecny since this is (MFC) GUI code, so for:
nVerify = VERIFY(privid, VALID_CHARS)
DO WHILE (nVerify > 0)
privid(nVerify:nVerify) = '_'
nVerify = VERIFY(privid, VALID_CHARS)
END DO
DO WHILE (nVerify > 0)
privid(nVerify:nVerify) = '_'
nVerify = VERIFY(privid, VALID_CHARS)
END DO
I used CString functions:
for (int i = 0; i < m_strItemName.GetLength(); i++)
{
chr = m_strItemName.GetAt(i);
nLoc = strValid.Find(chr, 0);
if (-1 == nLoc)
{
m_strItemName.SetAt(i, '_');
}
}
which seems a little less elegant, but works ok.
Thanks anyway,
Dan
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page