🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #483

Re: String manipulation

#483
From: Pete G.
Date: Tue, 03 Oct 2000 00:00
31 lines
2095 bytes
Use strcat (szBuffer, "\\");
By the way, your check for an existing '\\' is checking too far into the
string.  The value you are computing for len is adding 1 to include the
NULL.  The offset into the string for the last character should be
lstrlen(*lpFileName) - 1;
Also, how did you get from *lpFileName to szBuffer?  Also, the syntax you
are using would indicate that you are passing a pointer to a pointer to the
string in question.  Is this your actual intent?
Pete

"News" <jef_driesen@hotmail.com> wrote in message
news:39da0385.0@news.ruca.ua.ac.be...
> I need some help for string manipulation (without CString class).
> I know basics of C++, but never used strings.
> For example I need a function for appending a backslash after a directory
> name:
>
> VOID WINAPI AppendSlash(LPTSTR *lpFileName)
> {
>  len = lstrlen(*lpFileName) + 1;
>  if (len > 0 && szBuffer[len] != '\\')
>  {
>   // Modify string by adding a backsslash
>  }
> }
>
> Thanks,
> Jef Driesen
>
>
>
Technical Details
Message-ID: <uRnC5.1120$r6.711548@den-news1.rmi.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <39da0385.0@news.ruca.ua.ac.be>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f7a51,f2706f20e1973f75
X-Google-Attributes: gidf7a51,public
X-Google-Thread: 114592,f2706f20e1973f75
X-Google-Attributes: gid114592,public
X-Google-Thread: f5ca7,f2706f20e1973f75
X-Google-Attributes: gidf5ca7,public
X-Google-Thread: 103bde,f2706f20e1973f75
X-Google-Attributes: gid103bde,public
X-Google-Thread: 109fba,f2706f20e1973f75
X-Google-Attributes: gid109fba,public
From: "Pete G." <pgriggs@superflow.com>
Subject: Re: String manipulation
Date: 2000/10/03
Message-ID: <uRnC5.1120$r6.711548@den-news1.rmi.net>
X-Deja-AN: 677095060
References: <39da0385.0@news.ruca.ua.ac.be>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Complaints-To: news@rmi.net
X-Trace: den-news1.rmi.net 970590682 209.38.126.48 (Tue, 03 Oct 2000 10:31:22 MDT)
Organization: RMI.NET
X-MSMail-Priority: Normal
NNTP-Posting-Date: Tue, 03 Oct 2000 10:31:22 MDT
Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cpp.winapi,borland.public.cppbuilder.winapi,comp.lang.c++,microsoft.public.vc.language