473,883 Members | 1,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

malloc + 4??

http://www.yep-mm.com/res/soCrypt.c

I have 2 malloc's in my program, and when I write the contents of them to
the screen or to a file, there aren addition 4 characters.

As far as I can tell, both the code to register the malloc and to write
information into the malloc is solid. Why then ismy program returning an
additional 4 characters?

register malloc 1:
line 192

register malloc 2:
line 214

write to malloc 1:
line 200 - 205

write to malloc 2:
line 221 - 225

display malloc 2:
line 157

write malloc 2:
line 251

Here's how you execute the program:

socrypt.exe /e :i input.txt :o output.txt :A keya.txt :B keyb.txt :k
keyout.txt

**note that the input, keya, and keyb files must exist or the program will
return an error code.

If you write a text string into the input.txt file, it will write the same
string into the output.txt file plus an addition 4 characters.

The 1024 char random 'masterkey' is also written out to the keyout.txt file
with an addition 4 characters.

Why is this happening? I'm totally baffled and have spent days trying to
figure this out.
Nov 14 '05
144 5488

In article <c5**********@o ravannahka.hels inki.fi>, Joona I Palaste <pa*****@cc.hel sinki.fi> writes:

Yes, and this means that neither Spanish nor English is "pronounced
as written". Finnish is *almost* - the 'n' in "ng" or "nk" is not
pronounced like a normal 'n'. Otherwise it's "pronounced as written".


Japanese is pronounced as written, if you write it that way.

(OK, n' can be pronounced as /n/ or /m/, but that's a trivial
difference and a mistake would never cause confusion.)

If you write Japanese normally, of course, pronunciation can be a
real mystery, particularly for proper nouns.

Japanese can be written phonetically, using the kana syllabaries, but
no one other than young children and people beginning to study
Japanese as a foreign language does that, because it's almost
useless; Japanese is so full of homonyms that it becomes very
ambiguous. So proper written Japanese uses a mix of kana and kanji,
which are logographs adapted from Chinese. Typically kanji represent
the roots of nouns, verbs, adjectives, and adverbs, and kana is used
for grammatical suffixes and particles, other particles that serve as
postpositions, for sounding out onomatopoeia and foreign-origin
loan-words, and so forth.

Since each kanji typically has more than one pronunciation (often
due to associating it with both a spoken Japanese word and the
spoken (in whatever dialect) Chinese word it was adopted from),
reading written Japanese aloud often requires recognizing what word
is meant and then recalling how it's pronounced. And if it's a
proper name, there are often two or more reasonable choices; you
have to find someone who's familiar with the thing being named to
be sure.

Whether that's better or worse than English is a matter of taste.
You have to learn more symbols (about 2000) with Japanese, but
fewer wierd rules and exceptions. And with Japanese it's often
easier to understand the sense of a sentence even when you're not
sure how it should be pronounced.

--
Michael Wojcik mi************@ microfocus.com

Thanks for your prompt reply and thanks for your invitatin to your
paradise. Based on Buddihism transmigration, I realize you, European,
might be a philanthropist in previous life! -- supplied by Stacy Vickers
Nov 14 '05 #131
Irrwahn Grausewitz <ir*******@free net.de> wrote in
news:o4******** *************** *********@4ax.c om:
Joona I Palaste <pa*****@cc.hel sinki.fi> wrote:
Arthur J. O'Dwyer <aj*@nospam.and rew.cmu.edu> scribbled the following:


<snip>
Spanish used to consider both the 'll' and the 'ch' to be letters
in their own right, along with the enye (n+tilde; sorry, not in my
encoding). But IIRC recently the Spanish people in charge of the
"official" language decided to give up the separate letters for 'ch'
and 'll', and now you'll find "llama" in between "liviano" and
"local" in the dictionary.


IMHO, that's just silly. Considering a group of multiple glyphs as a
single letter can be very confusing.


But it's a concept not unheard of; other examples of ligatures are
the dutch 'ij' ("kijk"), the danish 'ae' (example?), the french 'oe'
("oevre") or the german 'sz' ("Flo").


English had (and still does, occasionally, have) ligatures and 'single
character' replacements too. Most of the silliness of "Ye Olde Print
Shoppe" being pronounced as "Yeee old print shop" was caused by the Herr
Guttenberg's device not having a 'thorn' character. The 'Y' was closest
glyph to it available (as standard), and hence it was common in print.
The thorn character was eventually replaced with 'th'. Remember folks:
"Ye" is just "The"!

(The thorn glyph was used by JRR Tolkien in the runes on the map Thorin
had in the hobbit. It sort of looks like:

|\
|/
|

)

Ian Woods

--
"I'm a paranoid schizophrenic sado-masochist.
My other half's out to get me and I can't wait."
Richard Heathfield
Nov 14 '05 #132
Ian Woods <ne******@wuggy NOCAPS.org> wrote:
<snip>
English had (and still does, occasionally, have) ligatures and 'single
character' replacements too. Most of the silliness of "Ye Olde Print
Shoppe" being pronounced as "Yeee old print shop" was caused by the Herr
Guttenberg's device not having a 'thorn' character. The 'Y' was closest
glyph to it available (as standard), and hence it was common in print.


That's interesting, I always wondered about the 'Ye' thing.
Luckily, 'Y' and not 'P' was chosen as a substitute... ;-)

Regards
--
Irrwahn Grausewitz (ir*******@free net.de)
welcome to clc: http://www.ungerhu.com/jxh/clc.welcome.txt
clc faq-list : http://www.faqs.org/faqs/C-faq/faq/
clc OT guide : http://benpfaff.org/writings/clc/off-topic.html
Nov 14 '05 #133
In <t7**********@1 27.0.0.1> Alberto =?iso-8859-1?Q?Gim=E9nez?= <al****@telelin e.es> writes:
El Tue, 13 Apr 2004 20:30:03 -0400, Joe Wright escribi:
With all due respect, Spain (Iberia) has four (more?) regions with
their own languages. Castille, Andalusia, Catalonia, Basque, etc.
Which of these are you talking about?


Spanish is Spanish, everywhere. Another thing is dialects, or people's
pronounciation . Other topic is Catalan, Basque, "gallego" (don't know
translation) , which are languages on their own.


Then, why do I see "Castellano " on so many DVDs, instead of "Espaol"?

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #134
Irrwahn Grausewitz wrote:


But it's a concept not unheard of; other examples of ligatures are
the dutch 'ij' ("kijk"), the danish 'ae' (example?),


The 'ae' is scandinavian and not purely danish. It is a single letter
though and has its own place in the alphabeth (it is number 27).

Norwegian examples: "baer" (berry), "skjaere" (cut) (also of interest is
is the skj sound, does not exist in english really, sort of like "ssh").

The ae is a single glyph though, .

So the above examples would be "br" and "skjre".

--
Thomas.

Nov 14 '05 #135
Thomas Stegen <ts*****@cis.st rath.ac.uk> scribbled the following:
Irrwahn Grausewitz wrote:
But it's a concept not unheard of; other examples of ligatures are
the dutch 'ij' ("kijk"), the danish 'ae' (example?),
The 'ae' is scandinavian and not purely danish. It is a single letter
though and has its own place in the alphabeth (it is number 27). Norwegian examples: "baer" (berry), "skjaere" (cut) (also of interest is
is the skj sound, does not exist in english really, sort of like "ssh"). The ae is a single glyph though, . So the above examples would be "br" and "skjre".


It's *NOT* "Scandinavi an". Only Danish and Norwegian (and maybe
Icelandic) use it. Finnish and Swedish use and instead of and .

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"There's no business like slow business."
- Tailgunner
Nov 14 '05 #136
In <p9************ *************** *****@4ax.com> Irrwahn Grausewitz <ir*******@free net.de> writes:
It's debatable where in dictionary sort order the 'sz' should be
placed, since it's neither really two letters [1] nor one letter
of it's own right. However, at least my old Duden dict suggests to
transcript it to 'SZ' when writing all caps - should be "FLOSZ" then.


What is beyond debate is that, under the new German spelling rules,
words like Abflu became Abfluss and not Abflusz.

Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Nov 14 '05 #137
Joona I Palaste wrote:

It's *NOT* "Scandinavi an". Only Danish and Norwegian (and maybe
Icelandic) use it. Finnish and Swedish use and instead of and .


Finland is not part of Scandinavia you know ;) Anyways yeah, I was
thinking of the sound, the letter has different appearance.

Some people include Finland in Scandinavia, but they are wrong.
Norway, Denmark and Sweden recognise each other as scandinavian,
they recognise no other countries as such. If you want to include
Finland and Iceland use the term "the nordic countries".

Finland and Russia lies on the scandinavian peninsula, but denmark
does not. So it is a bit strange that denmark is part of scandinavia
while finland is not from a geographical viewpoint. From a historic
perspective it is not so strange. The scandinavist political movement
advocated unifying Denmark, Sweden and Norway into a single kingdom.
Finland was part of the Russian empire and so couldn't be included in
this union, so a new term was invented to to mean the nordic
countries excluding Finland, this term was scandinavia. Now, this union
was never to be, but there was a monetary union (kroner) until the first
world war. We still use kroner, but they are not compatible with
eachother.

--
Thomas.

Nov 14 '05 #138
Thomas Stegen <ts*****@cis.st rath.ac.uk> scribbled the following:
Joona I Palaste wrote:
It's *NOT* "Scandinavi an". Only Danish and Norwegian (and maybe
Icelandic) use it. Finnish and Swedish use and instead of and .
Finland is not part of Scandinavia you know ;) Anyways yeah, I was
thinking of the sound, the letter has different appearance. Some people include Finland in Scandinavia, but they are wrong.
Norway, Denmark and Sweden recognise each other as scandinavian,
they recognise no other countries as such. If you want to include
Finland and Iceland use the term "the nordic countries".
I am aware of the formal situation. But generally when people talk
about Scandinavia, they mean the Nordic countries. I was going by the
pragmatic definition. Isn't pragmatism what this newsgroup is about
these days?
Finland and Russia lies on the scandinavian peninsula, but denmark
does not. So it is a bit strange that denmark is part of scandinavia
while finland is not from a geographical viewpoint. From a historic
perspective it is not so strange. The scandinavist political movement
advocated unifying Denmark, Sweden and Norway into a single kingdom.
Finland was part of the Russian empire and so couldn't be included in
this union, so a new term was invented to to mean the nordic
countries excluding Finland, this term was scandinavia. Now, this union
was never to be, but there was a monetary union (kroner) until the first
world war. We still use kroner, but they are not compatible with
eachother.


If Russia had never conquered Finland, the entire Finnish culture and
language would have ceased to exist as Finland would have been
assimilated into this aforementioned union. So, as much as we Finns hate
the Russians, they saved our entire culture and language from our *real*
enemies - the Scandinavians! (Only kidding - nothing personal against
Scandinavians, myself.)

--
/-- Joona Palaste (pa*****@cc.hel sinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"As we all know, the hardware for the PC is great, but the software sucks."
- Petro Tyschtschenko
Nov 14 '05 #139
Joona I Palaste wrote:

I am aware of the formal situation. But generally when people talk
about Scandinavia, they mean the Nordic countries.
Not when you are in Scandinavia.
I was going by the
pragmatic definition. Isn't pragmatism what this newsgroup is about
these days?


It is not a pragmatic definition, it is a mistake, common though.
When people here in britain ask me about Scandinavia I am usually
pragmatic and ask tell them that Finland is not part of scandinavia
if it is relevant (I also mention the Nordic countries at this point).
I don't just "assume" they know what they are talking about and go on
explaining.

--
Thomas.

Nov 14 '05 #140

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
683
by: john smith | last post by:
Can someone please explain to me what is happening when I do a malloc(0). This is what I did. int* p = (int*)malloc(0); Then I printed the value of p and of course it was non-null. But has it allocated memory or what?
34
6459
by: Richard Hunt | last post by:
I'm sorry for asking such a silly question, but I can't quite get my head around malloc. Using gcc I have always programmed in a lax C/C++ hybrid (which I suppose is actually c++). But I have started messing around in Plan 9, and that sort of thing is totally no go there :). Is this correct to allocate memory for my struct? It works on my computer, but I'm suspicious that I'm doing it wrong. --
231
23339
by: Brian Blais | last post by:
Hello, I saw on a couple of recent posts people saying that casting the return value of malloc is bad, like: d=(double *) malloc(50*sizeof(double)); why is this bad? I had always thought (perhaps mistakenly) that the purpose of a void pointer was to cast into a legitimate date type. Is this wrong? Why, and what is considered to be correct form?
7
2225
by: Rano | last post by:
/* Hello, I've got some troubles with a stupid program... In fact, I just start with the C language and sometime I don't understand how I really have to use malloc. I've readden the FAQ http://www.eskimo.com/~scs/C-faq/faq.html but it doesn't seem to answer my questions... So, I've made an example behind, with some included questions...
20
10771
by: spasmous | last post by:
main() { float * f; initialize_f(f); // ...use f for processing free(f); }
15
2601
by: Martin Jrgensen | last post by:
Hi, I have a (bigger) program with about 15-30 malloc's in it (too big to post it here)... The last thing I tried today was to add yet another malloc **two_dimensional_data. But I found out that malloc always returned null at this moment and the program exited (even though if I malloc'ed only 20 bytes or something)... Then I googled for this problem and found something about a memory pool??? Is that standard C? I didn't understand it,...
68
15752
by: James Dow Allen | last post by:
The gcc compiler treats malloc() specially! I have no particular question, but it might be fun to hear from anyone who knows about gcc's special behavior. Some may find this post interesting; some may find it off-topic or confusing. Disclaimers at end. The code samples are intended to be nearly minimal demonstrations. They are *not* related to any actual application code.
40
2625
by: Why Tea | last post by:
What happens to the pointer below? SomeStruct *p; p = malloc(100*sizeof(SomeStruct)); /* without a cast */ return((void *)(p+1)); /* will the returned pointer point to the 2nd struct? */ Seems to me there is no guarantee it will. /Why Tea
71
19166
by: desktop | last post by:
I have read in Bjarne Stroustrup that using malloc and free should be avoided in C++ because they deal with uninitialized memory and one should instead use new and delete. But why is that a problem? I cannot see why using malloc instead of new does not give the same result.
23
2739
by: raphfrk | last post by:
I am having an issue with malloc and gcc. Is there something wrong with my code or is this a compiler bug ? I am running this program: #include <stdio.h> #include <stdlib.h> typedef struct pxl { double lon, lat;
0
9933
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
11123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10836
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10407
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7960
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7114
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5794
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4211
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.