|
From: Per W. <pw...@ia...> - 2003-07-03 11:28:26
|
Don't do sizeof(temp).
You should write strlen(temp) characters.
Normally, it would be easier with:
f = fopen(szFileName,"wt");
...
for (loop = 0; loop < Number_of_Points; loop++)
fprintf(f,"%3d\n",ram1[loop]);
fprintf() will automatically adjust the '\n' to a '\r\n' on a windows
machine, and a single '\r' on a Mac.
/Per W
On Thu, 3 Jul 2003, Jorge Abramian wrote:
> Hi,
>
> I wrote this piece of code willing that the numbers be written in different lines. However, the linefeed does not work. Any hint?
>
> ///
> ...
> #define <stdio.h>
> ...
> hFile = CreateFile(szFileName, GENERIC_WRITE, 0, 0,
> CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
>
> for (loop=0;loop<Number_of_Points;loop++)
> {
> DWORD dWritten;
> sprintf (temp,"%3d\n\r",ran1[loop]);
> WriteFile(hFile, temp, sizeof(temp),&dWritten, NULL);
> }
>
> /////
> Thanks a lot
>
> JEA
>
>
> -------------------------------------------------------
> This SF.Net email sponsored by: Free pre-built ASP.NET sites including
> Data Reports, E-commerce, Portals, and Forums are available now.
> Download today and enter to win an XBOX or Visual Studio .NET.
> http://aspnet.click-url.com/go/psa00100006ave/direct;at.asp_061203_01/01
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|