Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > creating a file

Reply
Thread Tools

creating a file

 
 
jacob navia
Guest
Posts: n/a
 
      02-25-2011
Le 24/02/11 15:50, Hans Vlems a écrit :
> I was asked for a program that creates a file with a predermined
> filesize.
> Filesize is specifcied in bytes, but it is acceptable if the filesize
> ought to be a multiple of, say, the blocksize of the disk.
> On a VMS system creat has a few platform specific enhancements. But
> this needs to run on a WIndows XP system. Is there a function to do
> that, for either Visual C or the djgpp environment?
> Hans


Under windows you do that as follows:

(1) Create a File with CreateFile
(2) You move the file pointer to the desired size with SetFilePointerEx
(3) You set the end of the file with SetEndOfFile

You can find the documentation for those APIs in the documentation from
Microsoft.

 
Reply With Quote
 
 
 
 
Hans Vlems
Guest
Posts: n/a
 
      02-25-2011
On 25 feb, 09:08, jacob navia <ja...@spamsink.net> wrote:
> Le 24/02/11 15:50, Hans Vlems a crit :
>
> > I was asked for a program that creates a file with a predermined
> > filesize.
> > Filesize is specifcied in bytes, but it is acceptable if the filesize
> > ought to be a multiple of, say, the blocksize of the disk.
> > On a VMS system creat has a few platform specific enhancements. But
> > this needs to run on a WIndows XP system. Is there a function to do
> > that, for either Visual C or the djgpp environment?
> > Hans

>
> Under windows you do that as follows:
>
> (1) Create a File with CreateFile
> (2) You move the file pointer to the desired size with SetFilePointerEx
> (3) You set the end of the file with SetEndOfFile
>
> You can find the documentation for those APIs in the documentation from
> Microsoft.


Which works for VisualC, right?
Merci,
Hans
 
Reply With Quote
 
 
 
 
Mark Bluemel
Guest
Posts: n/a
 
      02-25-2011
On Feb 24, 11:19*pm, Hans Vlems <hvl...@freenet.de> wrote:
> ... Most people on c.l.c. either use Windows or at least are
> familiar with it.


Cue for a debate (or even a flame war). I haven't taken a census, but
I'm far from convinced that the majority here have experience of
developing on Windows.
 
Reply With Quote
 
Anders Wegge Keller
Guest
Posts: n/a
 
      02-25-2011
Mark Bluemel <> writes:

> On Feb 24, 11:19Â*pm, Hans Vlems <hvl...@freenet.de> wrote:
>> ... Most people on c.l.c. either use Windows or at least are
>> familiar with it.

>
> Cue for a debate (or even a flame war). I haven't taken a census, but
> I'm far from convinced that the majority here have experience of
> developing on Windows.


SCO and Linux for me. I've been working on an embedded MC860-based
platform before.

--
/Wegge

Leder efter redundant peering af dk.*,linux.debian.*
 
Reply With Quote
 
Mark Bluemel
Guest
Posts: n/a
 
      02-25-2011
On Feb 25, 8:38*am, Mark Bluemel <mark.blue...@googlemail.com> wrote:
> On Feb 24, 11:19*pm, Hans Vlems <hvl...@freenet.de> wrote:
>
> > ... Most people on c.l.c. either use Windows or at least are
> > familiar with it.

>
> Cue for a debate (or even a flame war). I haven't taken a census, but
> I'm far from convinced that the majority here have experience of
> developing on Windows.


It seems to me that Hans is in danger of breaking at least the 10th of
Spencer's commandment <http://www.lysator.liu.se/c/ten-
commandments.html>
 
Reply With Quote
 
jacob navia
Guest
Posts: n/a
 
      02-25-2011
Le 25/02/11 09:33, Hans Vlems a écrit :
> On 25 feb, 09:08, jacob navia<ja...@spamsink.net> wrote:
>> Le 24/02/11 15:50, Hans Vlems a crit :
>>
>>> I was asked for a program that creates a file with a predermined
>>> filesize.
>>> Filesize is specifcied in bytes, but it is acceptable if the filesize
>>> ought to be a multiple of, say, the blocksize of the disk.
>>> On a VMS system creat has a few platform specific enhancements. But
>>> this needs to run on a WIndows XP system. Is there a function to do
>>> that, for either Visual C or the djgpp environment?
>>> Hans

>>
>> Under windows you do that as follows:
>>
>> (1) Create a File with CreateFile
>> (2) You move the file pointer to the desired size with SetFilePointerEx
>> (3) You set the end of the file with SetEndOfFile
>>
>> You can find the documentation for those APIs in the documentation from
>> Microsoft.

>
> Which works for VisualC, right?
> Merci,
> Hans


No, it works for any compiler running windows, those are APIs of
the operating system
 
Reply With Quote
 
jacob navia
Guest
Posts: n/a
 
      02-25-2011
Le 25/02/11 00:19, Hans Vlems a écrit :
> So instead of disenganging my brain completely and go for the direct
> approach, I thought I'd better ask here
> first. Most people on c.l.c. either use Windows or at least are
> familiar with it.


Yes, but there is a vocal group of people that say that windows is the
empire of evil, etc.

I develop under windows and iphone/Apple. Lately, I got bored with
windows and changed to Apple, a great platform. It makes Unix
shine, it is a very good combination of a good GUI with a powerful
Unix system. Linux folks could learn something from them, after
more than a decade their system is as "usable" as SCO + Xwindows
was.

But surely I know something about windows, see my other answer
in this thread.
 
Reply With Quote
 
James Kuyper
Guest
Posts: n/a
 
      02-25-2011
On 02/24/2011 06:19 PM, Hans Vlems wrote:
....
> first. Most people on c.l.c. either use Windows or at least are
> familiar with it.


I use Windows only rarely - mostly when someone insists on using
Microsoft Word documents which rely upon features that Sun's OpenOffice
doesn't fully support when saving in M$ Word format. I've never written
a program for it; the closest I came was programs written for DOS, and
the last time I did that was 15 years ago.

--
James Kuyper
 
Reply With Quote
 
Chris H
Guest
Posts: n/a
 
      02-25-2011
In message <b9cd7285-6f1e-4ba5-9c9f-
s.com>, Mark Bluemel <> writes
>On Feb 24, 11:19*pm, Hans Vlems <hvl...@freenet.de> wrote:
>> ... Most people on c.l.c. either use Windows or at least are
>> familiar with it.

>
>Cue for a debate (or even a flame war). I haven't taken a census, but
>I'm far from convinced that the majority here have experience of
>developing on Windows.


Majority here or the majority of commercial developers? (i.e. leaving
aside home/hobby use) Then the vast majority will be developing on
Windows


--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/



 
Reply With Quote
 
Rui Maciel
Guest
Posts: n/a
 
      02-25-2011
jacob navia wrote:

> I develop under windows and iphone/Apple. Lately, I got bored with
> windows and changed to Apple, a great platform. It makes Unix
> shine, it is a very good combination of a good GUI with a powerful
> Unix system. Linux folks could learn something from them, after
> more than a decade their system is as "usable" as SCO + Xwindows
> was.


When was the last time you gave any linux distro a try?


Rui Maciel
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a File object out of the contents of jar/zip file kotauk@gmail.com Java 5 04-06-2006 08:36 PM
"Error Creating Control" when creating a custom control (Design Time). Can't see tooltip message. Ravi Ambros Wallau ASP .Net Web Controls 0 06-01-2005 02:36 PM
"Error Creating Control" when creating a custom control (Design Time). Can't see tooltip message. Ravi Ambros Wallau ASP .Net 0 06-01-2005 02:36 PM
Any way to rename a current File without creating a new File object? C-man Java 9 04-11-2004 04:21 AM
What is better /standard for creating files. a cpp file with header or cpp and seperate file for header DrUg13 C++ 1 02-10-2004 09:20 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57