From: r_z_aret on
On Tue, 27 Oct 2009 12:59:32 -0700 (PDT), "B.S" <giobs111(a)gmail.com>
wrote:

>It returned " The system cannot find the file specified."
>
>thanks for this code.
>
>i use TCHAR all time and i hadn't any problem and whats differens with
>TCHAR and char i think they are same.

No, they are NOT. Sometimes the difference is trivial, and sometimes
it is decidedly not. Although tchar.h is not meant for humans (I sure
needed several attempts to understand it), it defines TCHAR and
relatives, so understanding it will help you a lot.


-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 400
Boston, MA 02116
www.penfact.com
Useful reading (be sure to read its disclaimer first):
http://catb.org/~esr/faqs/smart-questions.html
From: B.S on
Thanks but in this program i need that file was all time opend but i
will notise it in ather projects. and its realy sucks that it's
imposible to delete some bytes.


and can anyone tell me where can i find more about TCHAr and char. I
whant to know where what use.
From: ScottMcP [MVP] on
On Oct 29, 2:17 pm, "B.S" <giobs...(a)gmail.com> wrote:
> Thanks but in this program i need that file was all time opend but i
> will notise it in ather projects. and its realy sucks that it's
> imposible to delete some bytes.

That is inherent is disk files. Disks can't move the bits around, so
code must be written to do it in memory and then write the new
configuration to disk.

> and can anyone tell me where can i find more about TCHAr and char. I
> whant to know where what use.

http://msdn.microsoft.com/en-us/library/ey142t48(VS.80).aspx
From: Friedel Jantzen on
Am Thu, 29 Oct 2009 11:17:13 -0700 (PDT) schrieb B.S:

> Thanks but in this program i need that file was all time opend but i

You could use memory-mapped files, but perhaps too complicated.
See CreateFileMapping, MapViewOfFile.

> will notise it in ather projects. and its realy sucks that it's
> imposible to delete some bytes.

You are right, file handling is complicated.
As you use fixed record lengths, you could do it like the DBASE dbf files:
The records are not deleted really, only a marker is set. All records,
which were marked for deleting, are deleted together on a compacting
eventually.

> and can anyone tell me where can i find more about TCHAr and char. I
> whant to know where what use.

See the link posted by Scott.

Using TCHAR, you can write code for ANSI _and_ Unicode (see my last
posting):
TCHAR programa[MAX_PATH] = _T("C:\\Programs\\wipeall.exe");
If you call a Win32 API passing a string, the correct version A or W of the
Api will be chosen depending on the defines. Very easy so far.
Then you have a file with ANSI string data in a Unicode app and want to
pass it to an Api function: Fails or looks like Chinese. You have to
convert it to Unicode with MultiByteToWideChar before.
If you write the Unicode version of the string programa to a file, you
write the bytes
C \0 : \0 .... \0 \0
If you want to write ANSI, you must convert it before with
WideCharToMultiByte. It is not possible with a cast, this would result in
the ANSI string "C".

HTH,
Friedel
From: Todd Aspeotis on
Don't use a type without knowing what it does? If you have UNICODE defined
then TCHAR will be wchar_t, not char.
http://msdn.microsoft.com/en-us/library/c426s321%28VS.71%29.aspx

"B.S" <giobs111(a)gmail.com> wrote in message
news:7304c0fc-183c-4c80-a83a-3089fe0650a9(a)k13g2000prh.googlegroups.com...
> Thanks but in this program i need that file was all time opend but i
> will notise it in ather projects. and its realy sucks that it's
> imposible to delete some bytes.
>
>
> and can anyone tell me where can i find more about TCHAr and char. I
> whant to know where what use.