'dwCreationDisposition'.
Call GetFileSize() or GetFileSizeEx() to retrieve the file size.
Allocate a buffer using the file size, set your cml->pszKeywords to this
newly allocated buffer.
Call ReadFile to read the entire file into the buffer.
HTH
Shyan
> -----Original Message-----
> From: Danny Jackson [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 08, 2004 2:53 PM
> To: [EMAIL PROTECTED]
> Subject: [c-prog] Opening and Reading a file
>
>
>
> Hello, I'm new to Win32 programming in C.
>
> What I need to do is to open a file using CreateFile, read the file
> to a global variable using ReadFile.
>
> The name of the file is C:\IDE\Lang.lng, its length is 761B
>
> This is the code I have so far.
>
> #include <stdio.h>
> #include <windows.h>
>
>
> //Language definition
> typedef struct _CM_LANGUAGE {
> DWORD dwStyle;
> BOOL bIsCaseSensitive;
> LPCTSTR pszKeywords;
> LPCTSTR pszOperators;
> LPCTSTR pszSingleLineComments;
> LPCTSTR pszMultiLineComments1;
> LPCTSTR pszMultiLineComments2;
> LPCTSTR pszScopeKeywords1;
> LPCTSTR pszScopeKeywords2;
> LPCTSTR pszStringDelims;
> TCHAR chEscape;
> TCHAR chTerminator;
> LPCTSTR pszTagElementNames;
> LPCTSTR pszTagAttributeNames;
> LPCTSTR pszTagEntities;
> } CM_FBSL;
>
> int CM_Fill( CM_FBSL *cml )
> {
> cml->pszKeywords = //I need to set this to the glogal variable
> }
>
> Any help would be greatly appreciated.
>
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
| Yahoo! Groups Sponsor | |
|
|
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
